Python给多个变量赋值
Posted jsplyy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python给多个变量赋值相关的知识,希望对你有一定的参考价值。
# 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
以上是关于Python给多个变量赋值的主要内容,如果未能解决你的问题,请参考以下文章