如何将坐标列表中的siteData从字符串转换为int
print(siteData)
cat|x|y|z
1|343741.396330097|1029255.04807763|0
2|342270.660062496|1030198.57861216|0
3|339743.874252208|1030705.47801259|0
4|343031.709457817|1027263.37839108|0
5|339453.578589758|1029954.65896125|0
6|341376.669330771|1029549.5339487|0
7|339224.904513178|1030438.74647616|0
8|340285.317292692|1029431.45860403|0
9|343135.800101739|1029804.27059289|0
10|338982.428513304|1028857.42081259|0
11|338405.612076696|1034287.30455498|0
12|338080.457138754|1034337.35427931|0
13|338944.90541069|1034519.90737124|0
14|340963.209546547|1032528.77710582|0
15|337891.948788692|1030626.74686363|0
根据Hozayfa的评论,您可以按如下方式进行操作:
可以在循环中使用变量
cat, x, y
和z
;它们将是int
类型编辑:这是假设
siteData
看起来就像这样:我认为csv模块更适合解析此类数据:
输出:
使用熊猫
输出
相关问题 更多 >
编程相关推荐