python学习笔记

1.python中的赋值,与C语言相比,没有返回值。

>>> x = 1
>>> y = (x = x + 1) # assignments not expressions! File "<stdin>", line 1
y = (x = x + 1)
^
SyntaxError: invalid syntax

2.python的“多元”赋值:

>>> x,y,z=1,2,3  #或 (x,y,z)=(1,2,3)
>>> z
3
>>> x
1

“=”两边的值都是元组。

posted @ 2012-10-11 17:31  黎明露珠  阅读(110)  评论(0编辑  收藏  举报