python中一般是一行寫完所有代碼,如果遇到一行寫不完需要換行的情況,有兩種方法:
1.在該行代碼末尾加上續行符“\”(即空格+\);
test='item_one'\
'item_two'\
'tem_three'
輸出結果:
'item_oneitem_twotem_three'
2.加上括號,(){}[]中不需要特別加換行符:
test2=('csdn'
'cssdn')
輸出結果:
csdncssdn
if...and:
if(wherethereisawilland
thereisaway)