# 写法:列表名.append(数据)
# 定义:往列表的最后位置添加数据
ac = ['茶叶','香烟','杯子','开水']
# print(ac.append('打火机')) #print只做添加,不出结果,返回None(空)
ac.append('打火机')
print(ac)
# 写法:列表名.insert(编号,数据)
# 指定位置添加数据
ac.insert(0,'手机架')
print(ac)
append与insert定义
发布时间 2023-12-25 10:31:21作者: 小姚.XiaoYao