问题:
.TXT:
194220.00 38.4397984 S 061.1720742 W 0.035
194315.00 38.4398243 S 061.1721378 W 0.036
Python:
myList = ('38.4397984,061.1720742','38.4398243,061.1721378')
回答问题。如何将 txt 中的浮点数作为字符串转换为 Python 列表
代码:
with open('haha.txt') as f:
for line in f:
words = line.split()
print words
my_list.append(words[1] + words[3])
我的测试代码没有产生预期的结果。它有什么问题?我错过了,
...
['38.4397984061.1720742', '38.4398243061.1721378']