Python中如果遇到一行寫不完需要換行的情況,有兩種方法:
1.在該行代碼末尾加上續行符“ \”。
test = 'Network' 'security' 'guard'
輸出結果:
‘Networksecurityguard’
2.加上括號,() {} []中不需要特別加換行符。
test2 = ('Network ' 'security')
Network security
if…and:
if (where there is a will and
多次未輸出結果
test3 =('Network' ' ' 'security')
Hello world
回答所涉及的環境:聯想天逸510S、Windows 10。
Python中如果遇到一行寫不完需要換行的情況,有兩種方法:
1.在該行代碼末尾加上續行符“ \”。
輸出結果:
‘Networksecurityguard’
2.加上括號,() {} []中不需要特別加換行符。
輸出結果:
Network security
if…and:
if (where there is a will and
多次未輸出結果
輸出結果:
Hello world
回答所涉及的環境:聯想天逸510S、Windows 10。