赞
踩
在使用python包json,load文件时,报错:AttributeError: 'str' object has no attribute 'read'
- import json
- data = json.load("社区图层_wgs84_修正街道ID.geojson",encoding='utf8')
具体问题如下截图
- import json
- with open("社区图层_wgs84_修正街道ID.geojson",encoding='utf8') as f:
- data = json.load(f)
-
-
- # 或者
- data = json.load(open("社区图层_wgs84_修正街道ID.geojson",encoding='utf8'))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。