记录遇到的关于和python相关的问题
-
python print array时array中间是省略号没有输出全部的解决方法
在开头加入import numpy as np np.set_printoptions(threshold=np.inf)
-
python--- JsonPath从多层嵌套Json中解析所需要的值
dic = { "error_code": 0, "stu_info": [ { "id": 2057, "name": "xiaohei", "sex": "nan", "age": 29, "addr": "beijing", "grade": "tianxie", "phone": "18712321234", "gold": 100 } ] } import jsonpath s = jsonpath.jsonpath(dic,'$..name') #不管有多少层,写两个.都能取到 print(s) #['xiaohei'] 返回的是一个列表 s = jsonpath.jsonpath(dic,'$..hehe') #当不存在hehe这个key时,返回false print(s) #False
-
错误ValueError: Object arrays cannot be loaded when allow_pickle=False
解决方法:将numpy回到旧版本1.16.1或1.16.2版本即可conda install numpy=1.16.2
or
pip install numpy=1.16.2
From: https://blog.csdn.net/weixin_42096901/article/details/89855804