码迷,mamicode.com
首页 > 编程语言 > 详细

Python给多个变量赋值

时间:2016-07-02 15:50:10      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

# 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给多个变量赋值

标签:

原文地址:http://www.cnblogs.com/jsplyy/p/5635369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!