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

 

上一篇:Python基础知识:新手学Python时常见的语法错误和异常


下一篇:1673. Find the Most Competitive Subsequence