if的特殊使用

来源:互联网 发布:淘宝首页制作图 编辑:程序博客网 时间:2024/05/16 12:12

            if len(str2) != 1:
                if strl == "NULL":
                    print(strl)
                    outB.append(row)
                else:
                    continue
            elif len(str2) == 1:
                number = str2[0]
                if 1886 <= int(number) <= 2014:
                    row['productionStartYear'] = int(number)
                    outG.append(row)
                    print(row['productionStartYear'])
                else:

                    outB.append(row)


1.表示100<=i<=200可直接写为

if 100<=i<=200

2.表示或

if i=1 or i=2

3.多个判断

if:

elif:

elif:

else:

原创粉丝点击