python代码长度过长时候换行的几种方式

python代码如何换行

字符串过长换行

# 三个双引号, print(a) 出来的是两行

a = """hello world
hello world"""


# 三个单引号, print(b) 出来的是两行

b = ''' hello world
hello world'''


# 使用 \ , print(c)出来的是一行

c = "hello " \
	"world"

表达式换行

# 使用 \
d = a+b\
	+c

# 使用括号
d = (a + 
	c)

转载自:https://blog.csdn.net/u012436149/article/details/101762597

猜你喜欢

转载自blog.csdn.net/qq_39900031/article/details/114993885