标签:补充一个列表实用的操作
enumerate(names) 获取列表的下标names=["Zhangfei","Guanyu","Liubie","Zhaoyun","Machoa","Jiangwei","Mashu","Zhaoyun"]
print(names.index("Zhaoyun"))
print(names[names.index("Zhaoyun")],‘\n‘)
for index,name in enumerate (names): # 取出列表的下标
print(index,name )
标签:补充一个列表实用的操作
原文地址:http://blog.51cto.com/13747953/2119702