一、链式赋值
例1
a = 10
b = 10
c = 10
d = 10
print(f'a:{a}, b:{b}, c:{c}, d:{d}')
输出
a:10, b:10, c:10, d:10
例2
a = b = c = d = 10
print(f'a:{a}, b:{b}, c:{c}, d:{d}')
输出
a:10, b:10, c:10, d:10
二、交叉赋值
例1
x = 100
y = 200
temp = x
x = y
y = temp
print(f'x:{x}')
print(f'y:{y}')
输出
x:200
y:100
例2
#Python学习交流群:711312441
x, y = y, x
print(f'x:{x}')
print(f'y:{y}')
输出
x:100
y:200
标签:多种,200,python,输出,print,100,赋值,10
From: https://www.cnblogs.com/xxpythonxx/p/17138728.html