string indices must be integers
这个错误告诉我,\[ \]里面应该是数字而不是字符串,
~~~
a={"code":0,"message":"OK","data":{"recognize_warn_msg":[],"recognize_warn_code":[],"items":[{"itemcoord":{"x":22,"y":36,"width":87,"height":26},"words":[{"character":"么","confidence":0.6924936175346375},{"character":"上","confidence":0.9979987740516664},{"character":"抑","confidence":0.6606981754302979},{"character":"油","confidence":0.9161732792854308}],"itemstring":"么上抑油"},{"itemcoord":{"x":128,"y":118,"width":90,"height":26},"words":[{"character":"以","confidence":0.9816042184829712},{"character":"必","confidence":0.50948566198349},{"character":"当","confidence":0.8555372953414917},{"character":"镜","confidence":0.9988377690315248}],"itemstring":"以必当镜"},{"itemcoord":{"x":101,"y":187,"width":80,"height":20},"words":[{"character":"创","confidence":0.4055652618408203},{"character":"您","confidence":0.722910463809967},{"character":"之","confidence":0.9305914044380188},{"character":"心","confidence":0.8593043088912964}],"itemstring":"创您之心"}],"session_id":"1258491432707977226","angle":1.98828125,"class":[]}}
print type(a) #dict
items=a["data"]["items"]
~~~
a是dict ,所以 items=a["data"]["items"] 可以执行成功
如果a是Unicode,会出现报错string indices must be integers
- python_study
- 模拟屏幕单击_坐标法
- 获取窗口句柄
- 二维list
- class定义
- webdriver八种元素定位
- selenium调用js
- iframe页面定位
- 生成html报告
- 将列表中文数据写入文件
- python strip()函数
- re模块
- 字符类型
- requests与urllib
- dict
- 如何定位APP上的webview控件
- Python如何从一个文件中调用另一个文件的类
- python函数传入参数(默认参数、可变长度参数、关键字参数)
- *args和**kwargs用法
- ActionChains
- 取整
- join
- 大写小写
- try except
- ospath
- md5
- 读取文件中的汉字
- selenium 等待方式
- 截图
- 获取字符串
- Unicode和utf-8
- 时间
- adbshell查看手机性能
- unitest
- 定时任务
- url3报错导入
- js
- mysql
- logging
- 封装元素是否存在
- 读取文件
- 封装数据库
- Python3读取word文件
- Python接口测试
- 如何使用Excel
- request发送post请求
- post请求中的json和dict转换
- eval
- 框架功能
- 截图保存
- 云服务器
- 安装mysql
- 修改云服务器root密码
- 云服务器远程连接
- Vim
- mysql数据库
- 测试问题记录
- 1.真机appium运行Chrome
- 2.appium报错
- 3.no attribute 'Chrome'
- 4.三生未支付但成功了
- 5.待解决问题
- 6.APP web定位元素问题
- 7.adb找不到设备
- 8.automator2问题
- 9.往shouji/data/tmp中放置文件
- 10.中易汇,系统金额减少1700
- appium提示没有对应的Chromedrvier版本
- kivi安装
- python解析json时出现“string indices must be integers”
- python中unicode 和 str相互转化
- move_to_element_offset
- 元素size、location
- js弹框一闪即逝如何定位
- 安全测试
- python adb
- unicodedecodeerror
- parent_frame
- uiaoutomator报错
- 支付流程测试
- 提示urllib3 waring警告
- 概念知识
- appium
- 无线连接手机
- appium用法
- github
- 查看activity
- moco
- fiddler
- 关于抓包
- 模拟低速
- DDMS
- DDMS 不显示进程
- Android
- 获取内存信息
- selenium
- web元素定位
- driver