我有以下格式的 .txt 文件:
AM|75019|Caribbean from 15N to 18N between 80W and 85W|18.757950|-81.741300
AM|75021|Caribbean from 15N to 18N between 72W and 80W|18.757950|-81.741300
AM|75015|Caribbean approaches to the Windward Passage|15.133340|-68.139050
我只想提取前两列用作key:value. 例如,AM:75019,AM:75021等。我是 python 新手(使用 2.6),不知道如何做到这一点。我搜索并发现了多个不完全有意义的答案,因为有多个列。
