分类
python Questions

python怎么在列表中插入元素

sitelist = ['baidu','ali','tencent']
#输出为
sitelist = ['baidu','chiplayout','ali','tencent']

“python怎么在列表中插入元素”上的一条回复

>>> sitelist = ['baidu','ali','tencent']
>>> sitelist.insert(1,'chiplayout')
>>> print(sitelist)
['baidu', 'chiplayout', 'ali', 'tencent']

发表评论

电子邮件地址不会被公开。 必填项已用*标注