Casting from list of lists of strings to list of lists of ints in python

后端 未结 1 1115
鱼传尺愫
鱼传尺愫 2020-12-10 05:59

I\'m reading some numbers from a data source that represent xy coordinates that I\'ll be using for a TSP-esque problem. I\'m new to python, so I\'m trying to make the most

相关标签:
1条回答
  • 2020-12-10 06:20
    x = [['565.0', '575.0'], ['1215.0', '245.0'], ['1740.0', '245.0']]
    x = [[int(float(j)) for j in i] for i in x]
    
    0 讨论(0)
提交回复
热议问题