原始文件格式如下所示
ID DC_trip
AC A9999
SY DC,Foggy_bottom,22201,H_St.
SY DC,Smithsonian,12345,14th_St.
//
ID ...
AC ...
SY ...
SY ...
SY ...
我想将其转换为.csv文件格式并将其转换为
华盛顿特区,A9999,华盛顿特区,雾底,22201,H_St.
华盛顿特区,邮编:12345,14街,邮编:A9999。
.
.
. 在
我试着用if语句和elif。。。。。在
^{pr2}$如果我用这种方法,每次只能得到一个值。 有人能给我推荐一下吗? 谢谢你
假设原始文件中的数据是制表符分隔的,则可以使用csv模块,并执行以下操作:
如果原始文件中的数据由空格分隔,则应将第一部分替换为:
^{pr2}$相关问题 更多 >
编程相关推荐