Python 向列表中添加元素

向列表中添加元素

1.append

tabulation1.append('紫霞')
['大圣', '天蓬', '卷帘', '紫霞', '紫霞', '青霞']

2.insert

tabulation1.insert(1,'紫霞')
['大圣', '紫霞', '天蓬', '卷帘', '紫霞', '紫霞', '青霞']

出处:https://www.jb51.net/article/131400.htm

python寻找list中最大值、最小值并返回其所在位置

c = [-10,-5,0,5,3,10,15,-20,25]

print c.index(min(c))  # 返回最小值的位置
print c.index(max(c)) # 返回最大值的位置
原文地址:https://www.cnblogs.com/zhangdingqu/p/9501431.html