使用Python将存储在列表中的DMS值转换为CSV文件
我有一长串的DMS值,如下所示。
lst = ['9', '22', '26.9868', 'N',
'118', '23', '48.876', 'E',
'9', '22', '18.6132', 'N',
'118', '23', '5.2188', 'E',
'9', '19', '41.4804', 'N',
'118', '19', '23.1852', 'E']
我想以以下格式写入此数据为CSV文件:
I have a long list of DMS values that look like below.
lst = ['9', '22', '26.9868', 'N',
'118', '23', '48.876', 'E',
'9', '22', '18.6132', 'N',
'118', '23', '5.2188', 'E',
'9', '19', '41.4804', 'N',
'118', '19', '23.1852', 'E']
I want to write this data as a csv file in the following format:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
numpy
和pandas
:输出文件(作为文本):
You can use
numpy
andpandas
:Output file (as text):
如果
lst
是您问题的列表,则可以执行:此写入
data.csv
:screenshot来自libreoffice:
If
lst
is the list from your question, you can do:this writes
data.csv
:screenshot from LibreOffice: