Python读取json文件,并转化为字典进行提取字段(出现索引must be int,not str)解决方案
来源:互联网 发布:超融合和云计算 编辑:程序博客网 时间:2024/06/03 22:08
Python读取json文件,并转化为字典进行提取字段(出现索引must be int,not str)解决方案
def craw_file(): di_review_keyword=[] for i in range(10): with open('E:\python_py\景区详情\\test\\'+'北京'+'_'+str(0)+'_'+str(1)+'.json','r') as file: #d读取文件,并转换成json格式 html=file.read() # html_json=json.loads(html) #以json形式加载 # # print(type(html),type(html_json)) html_dict=eval(html) #将其转化为字典并进行提取(一般出现索引must be int,not str) print(type(html_dict),html_dict) html_result=html_dict["result"] #基本信息 name=html_result["name"] address=html_result["address"]
阅读全文
0 0
- Python读取json文件,并转化为字典进行提取字段(出现索引must be int,not str)解决方案
- Python出现TypeError: file() argument 1 must be encoded string without NULL bytes, not str问题解决
- TypeError: the JSON object must be str, not 'bytes'
- TypeError: the JSON object must be str, not 'TextIOWrapper'
- Python 读写文件 中文乱码 错误TypeError: write() argument must be str, not bytes+
- Python 读写文件 错误TypeError: write() argument must be str, not bytes+
- Python之Headers value 1 must be of type str or bytes, not <class 'int'>错误的解决
- Python中报错TypeError: must be str, not bytes
- python-TypeError: write() argument must be str, not numpy.float64
- 使用pickle将对象存储到文件中时出现 TypeError: write() argument must be str, not bytes
- mySQL给空间字段建立索引出现错误All parts of a SPATIAL index must be NOT NULL的解决办法
- Python处理json字符串转化为字典
- Python处理json字符串转化为字典
- Python处理json字符串转化为字典
- TypeError: must be str, not bytes
- write() argument must be str, not bytes
- TypeError: must be str, not bytes
- python出现super.__init__:TypeError:must be type,not classobj
- CSS声明
- C++中New机制的深入挖掘
- 内部类
- git subtree 的安装
- C/C++ 下如何判断空指针
- Python读取json文件,并转化为字典进行提取字段(出现索引must be int,not str)解决方案
- 1、初识SpringBoot
- android studio常用快捷键
- WD硬盘北京总代收货地址
- AV_PIX_FMT_YUV420P与AV_PIX_FMT_YUVJ420P
- PL/SQL Developer的安装配置
- VxLAN和GRE
- An ffmpeg and SDL Tutorial 学习笔记(六)
- Cocos2d-x 纹理优化