编程语言
首页 > 编程语言> > python中同时给多个 变量赋值、同时清空多个变量

python中同时给多个 变量赋值、同时清空多个变量

作者:互联网

 

>>> a = 5
>>> print(a)
5
>>> b = 7
>>> print(b)
7
>>> c = 9
>>> print(c)
9
>>> a,b,c = 4,0,3  ## 同时给多个变量赋值
>>> print(a)
4
>>> print(b)
0
>>> print(c)
3
>>> del a,b,c    ## 同时删除多个变量
>>> print(a)
Traceback (most recent call last):
  File "<pyshell#191>", line 1, in <module>
    print(a)
NameError: name 'a' is not defined
>>> print(c)
Traceback (most recent call last):
  File "<pyshell#192>", line 1, in <module>
    print(c)
NameError: name 'c' is not defined

 

标签:last,变量,多个,python,NameError,most,print
来源: https://www.cnblogs.com/liujiaxin2018/p/14144124.html