python中较长的语句如果一行写不完可以用“\”来连接多行语句
在(),{},[] 中无需用“\”连接
print('hello world,\
I am \
KangKang')
s = [1,2,3,
4,5,6,
7,8,9]
print(s)
运行结果如下
hello world,I am KangKang
[1, 2, 3, 4, 5, 6, 7, 8, 9]
python中较长的语句如果一行写不完可以用“\”来连接多行语句
在(),{},[] 中无需用“\”连接
print('hello world,\
I am \
KangKang')
s = [1,2,3,
4,5,6,
7,8,9]
print(s)
运行结果如下
hello world,I am KangKang
[1, 2, 3, 4, 5, 6, 7, 8, 9]