python中一般是一行寫完所有代碼,如果遇到一行寫不完需要換行的情況,有兩種方法:
1.在該行代碼末尾加上續行符“\”(即空格+\);
test='item_one'\
'item_two'\
'tem_three'
輸出結果:
'item_oneitem_twotem_three'
2.加上括號,(){}[]中不需要特別加換行符:
test2=('csdn'
'cssdn')
輸出結果:
csdncssdn
if...and:
if(wherethereisawilland
thereisaway)
多次未輸出結果
test3=('Hello'
''
'world')
輸出結果:
Helloworld
以上內容為大家介紹了python培訓之寫代碼怎么跳到下一行,希望對大家有所幫助,如果想要了解更多Python相關知識,請關注IT培訓機構:千鋒教育。