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
推荐文章