for else break用法

Python语法笔记二_参数说明


pass可以用来占位,使分支结构正常

井号+ TODO,显示后面要做的事情

但是py文件要在主文件下

function里面的变量不能有大写字母
右键变量,refactor-rename,批量给变量改名字
for else用来遍历搜索字典,很有用

def search_card():
    print("-" * 50)
    print("search business cards")

    find_name=input("Please input the name you want to search")

    for card_dict in card_list:
        if card_dict["name"] == find_name:
            print("Get it!")
            break
    else:
        print("Sorry,can not find it")

move line up,代码块整体上移一行
在函数名字附近,可以插入参数说明