因为字符串是一个列表文本,所以可以使用
ast.literal_eval
安全地计算表达式节点或Unicode或Latin-1编码的
import ast
a = u'[[[1.7594271439650333, 41.82815539277221], [1.7594360823099031, 41.82815010753548], [1.7594365489105126, 41.828102229437455], [1.75943006926896, 41.82809815273617], [1.7593938715967752, 41.8280981826361], [1.75938821767524, 41.828104309113314], [1.759388051589258, 41.8281507714983], [1.7594271439650333, 41.82815539277221]]]'
mydata = ast.literal_eval(a)
mytuple = [tuple(l) for l in mydata[0]]
print(mytuple)
输出
[(1.7594271439650333, 41.82815539277221), (1.7594360823099031, 41.82815010753548), (1.7594365489105126, 41.828102229437455), (1.75943006926896, 41.82809815273617), (1.7593938715967752, 41.8280981826361), (1.75938821767524, 41.828104309113314), (1.759388051589258, 41.8281507714983), (1.7594271439650333, 41.82815539277221)]