编程语言
首页 > 编程语言> > python 给多个变量赋值

python 给多个变量赋值

作者:互联网

# assign values directly
a = b = 'hello'
a, b = 1, 2
print(b, type(b))
assign a == 1 and b == 2


# assign values from a list
tt2 = [r, g, b] = ["Red", "Green", "Blue"]
print(tt2, type(tt2))


# assign values from a tuple
t3 = (x, y) = (3, 4)
print(x, type(x))
print(t3, type(t3))

 

标签:变量,python,tt2,t3,values,print,type,assign,赋值
来源: https://www.cnblogs.com/karl-python/p/14498487.html