我在python中有一个循环代码,如下所示:
for index, row in maproad.iterrows():
road = wkb.loads(row['THE_GEOM'], hex=True)
buffered_road = Polygon(road.buffer(0.00015,cap_style=2,resolution=2))
print(row['OBJECTNAME'])
c.write({
'geometry': mapping(Polygon(buffered_road.exterior)),
'properties': {'name': row['OBJECTNAME']}
})
if road:
road = wkb.loads(row['THE_GEOM'], hex=False)
continue
我想继续循环,但它会抛出THE_GEOM解析错误。 所以我卡住了,我真的是愚蠢的菜鸟。 三江源
答案 0 :(得分:1)
try:
<code that might give error>
except Whatever_Error:
continue