马士兵Python学习笔记_P67_66.什么是元组
一、什么是元组
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a3d304cee859e23ad47632ae44f654bd.png)
二、代码示例
lst = [10, 20, 45]
print(lst, type(lst), id(lst))
lst.append(300)
print(lst, type(lst), id(lst))
str = "hello"
print(str, type(str), id(str))
str = str + "world"
print(str, type(str), id(str))
运行结果:
D:\Environment\Python\Python311\python.exe D:\Environment\PythonWorks\learnpython\马士兵Python\第8章_是排还是散\P67_66.什么是元组.py
[10, 20, 45] <class 'list'> 2258346675520
[10, 20, 45, 300] <class 'list'> 2258346675520
hello <class 'str'> 2258346674928
helloworld <class 'str'> 2258347586288
Process finished with exit code 0
B站视频链接:https://www.bilibili.com/video/BV1wD4y1o7AS?p=67