老司机

老司机和新手的区别是什么?
新手的if这样写

i = 1
if i == 1:
    a = '是'
else:
    a = '否'

老司机的if这样写

i = 1
a = '是' if i == 1 else '否'

你可能感兴趣的:(python)