我有一个元组列表
b = [('676010', '5036043'), ('771968', '4754525'), ('772025', '4754525'), ('772072', '4754527'), ('772205', '4754539'), ('772276', '4754542'), ('772323', '4754541'), ('647206', '5036049')]
我map()
用来将它们转换为 type float
。
In [45]: print [map(float,e) for e in b]
[[676010.0, 5036043.0], [771968.0, 4754525.0], [772025.0, 4754525.0], [772072.0, 4754527.0], [772205.0, 4754539.0], [772276.0, 4754542.0], [772323.0, 4754541.0], [647206.0, 5036049.0]]
如何对带有 的元素进行数学运算map()
,比如说除以 100,000?
我知道以不同的方式到达那里,但是我该如何实现map()
呢?
In [46]: print [(float(tup[0])/100000,float(tup[1])/100000) for tup in b]
[(6.7601, 50.36043), (7.71968, 47.54525), (7.72025, 47.54525), (7.72072, 47.54527), (7.72205, 47.54539), (7.72276, 47.54542), (7.72323, 47.54541), (6.47206, 50.36049)]