标签:image shu style 需求 .com log name position 并且
name = [‘wangxiaohua‘,‘wangdashu‘,6,9,9,80,‘haha‘,‘alex‘,34,34,‘wq‘,34,9,‘dfd‘,34,9,‘weew‘]
找出name列表中有多少个9并且全部将9修改成9999
找出所有的34并且全部删除
name = [‘wangxiaohua‘,‘wangdashu‘,6,9,9,80,‘haha‘,‘alex‘,34,34,‘wq‘,34,9,‘dfd‘,34,9,‘weew‘] #将name列表中的所有9修改成9999 for i in range(name.count(9)): position_of_ele = name.index(9) name[position_of_ele] = 9999 print(name) #删除name列表中的所有34元素 for i in range(name.count(34)): position_of_ele = name.index(34) name.remove(34) print(name) #打印结果 ‘‘‘ 将全部9修改为9999 [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9, 80, ‘haha‘, ‘alex‘, 34, 34, ‘wq‘, 34, 9, ‘dfd‘, 34, 9, ‘weew‘] [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, 34, 34, ‘wq‘, 34, 9, ‘dfd‘, 34, 9, ‘weew‘] [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, 34, 34, ‘wq‘, 34, 9999, ‘dfd‘, 34, 9, ‘weew‘] [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, 34, 34, ‘wq‘, 34, 9999, ‘dfd‘, 34, 9999, ‘weew‘] 将34元素全部删除 [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, 34, ‘wq‘, 34, 9999, ‘dfd‘, 34, 9999, ‘weew‘] [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, ‘wq‘, 34, 9999, ‘dfd‘, 34, 9999, ‘weew‘] [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, ‘wq‘, 9999, ‘dfd‘, 34, 9999, ‘weew‘] [‘wangxiaohua‘, ‘wangdashu‘, 6, 9999, 9999, 80, ‘haha‘, ‘alex‘, ‘wq‘, 9999, ‘dfd‘, 9999, ‘weew‘] ‘‘‘
标签:image shu style 需求 .com log name position 并且
原文地址:http://www.cnblogs.com/little-turtle/p/6363487.html