Python基本类型与引用类型

>>> a=1
>>> a
1
>>> b
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    b
NameError: name 'b' is not defined
>>> b=a
>>> b
1
>>> b=b+1
>>> b
2
>>> a
1
>>> a=['a','b']
>>> a
['a', 'b']
>>> b=a
>>> b
['a', 'b']
>>> b.append('c')
>>> b
['a', 'b', 'c']
>>> a
['a', 'b', 'c']
>>> 
posted @ 2022-04-29 22:37  WORDLESS  阅读(55)  评论(0编辑  收藏  举报