标签:
aa = (1, 2, 3, 4, 5, 6) b = [(x == 5 and 8 or x) for x in aa] z = map(lambda x: 8 if x == 5 else x, [i for i in b]) print(b) print(z)
使用python将元组转换成列表,并替换其中元素
原文地址:http://www.cnblogs.com/or2-/p/4470050.html