How can I apply a math operation on a list of tuples with `map()`?

后端 未结 2 1580
一向
一向 2021-01-28 06:35

I have a list of tuples

b = [(\'676010\', \'5036043\'), (\'771968\', \'4754525\'), (\'772025\', \'4754525\'), (\'772072\', \'4754527\'), (\'772205\', \'4754539\'         


        
2条回答
  •  梦谈多话
    2021-01-28 07:15

    >>> map(lambda x: tuple([float(x[0])/100000, float(x[1])/100000]), 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)]
    >>>
    

提交回复
热议问题