在python3+里面不能像C++那样对各个变量依次赋值,中间以‘,’隔开
例如:
>>> a=2,b=3
SyntaxError: can't assign to literal
>>> a=2
>>> b=3
>>> a,b=2,3
>>> a
2
>>> b
3
更多多个变量依次赋值的方法:
转自:http://www.cnblogs.com/wc-chan/p/8080765.html
# Assign values directly
a, b = 0, 1
assert a == 0
assert b == 1
# Assign values from a list
(r,g,b) = ["Red","Green","Blue"]
assert r == "Red"
assert g == "Green"
assert b == "Blue"
# Assign values from a tuple
(x,y) = (1,2)
assert x == 1
assert y == 2