python报错 TypeError: string indices must be integers
if 'like' in condition:
cond_str1 = condition.split('like')[0].strip()
cond_str2 = condition.split('like')[1].strip()
print(staff_info)
ret = filter(lambda x:cond_str2 in str(x[cond_str1]), staff_info) # 这里字典写错

python报错 TypeError: string indices must be integers的更多相关文章
- TypeError: string indices must be integers, not str
1. TypeError: string indices must be integers, not str 字符串类型取第index个字符的时候,应该传入int而不是str.如 1 a='abcde ...
- python报错 TypeError: a() got multiple values for argument 'name'
[问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError: got multiple values for argument 只是很简单的调用 from tsu2Ru ...
- python 报错TypeError: 'range' object does not support item assignment,解决方法
贴问题 nums = range(5)#range is a built-in function that creates a list of integers print(nums)#prints ...
- Python报错TypeError: '<' not supported between instances of 'str' and 'int'
n = input() if n>=100:print(int(n)/10) else:print(int(n)*10) 报错内容: Traceback (most recent call la ...
- faster rcnn报错:TypeError: slice indices must be integers or None or have an __index__ method
https://blog.csdn.net/qq_27637315/article/details/78849756 https://blog.csdn.net/qq_21089969/article ...
- for遍历用例数据时,报错:TypeError: list indices must be integers, not dict,'int' object is not iterable解决方法
一:报错:TypeError: list indices must be integers, not dict for i in range(0,len(test_data)): suite.addT ...
- Python报错:TypeError: data type not understood
K-Means聚类算法 def randCent(dataSet, k): m, n = dataSet.shape # numpy中的shape函数的返回一个矩阵的规模,即是几行几列 centrod ...
- appium 提示报错“TypeError: 'unicode' object is not callable”的解决方式!
这里提到的这个报错,是小错误且容易经常会犯,有时需要特别注意使用. 目的要求结果:根据某个元素的id值获取到对应id的text值,并且将获取的text值与本身存在的text值做比较,查看text值是否 ...
- Python报错总结丶自定义报错
Python报错总结: 常见异常 1,NameError: name 'a' is not defined:未定义函数名 2,IndentationError: uninden ...
随机推荐
- 【vijos】1543 极值问题(数论+fib数)
https://vijos.org/p/1543 好神奇的一题.. 首先我竟然忘记n可以求根求出来,sad. 然后我打了表也发现n和m是fib数.. 严格证明(鬼知道为什么这样就能对啊,能代换怎么就能 ...
- 【BZOJ】3404: [Usaco2009 Open]Cow Digit Game又见数字游戏(博弈论)
http://www.lydsy.com/JudgeOnline/problem.php?id=3404 写挫好几次.... 裸的博弈论即可.. #include <cstdio> #in ...
- Linux IO操作——RIO包
1.linux基本I/O接口介绍 ssize_t read(int fd, void *buf, size_t count); ssize_t write(int fd, void *buf, siz ...
- WPF界面框架的设计
http://www.cnblogs.com/baihmpgy/p/osgi_muinavtree_fx.html
- sql查询某个字段最长的记录
select `字段`, length(`字段`) from 表名 where length(`字段`) = ( select max(length(`字段`)) from 表名 )
- 69、ViewPagerIndicator+ViewPager实现Tab
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...
- python 之 re模块(正则表达式)
一.起源(历史) 正则表达式的“鼻祖”或许可一直追溯到科学家对人类神经系统工作原理的早期研究.美国新泽西州的Warren McCulloch和出生在美国底特律的Walter Pitts这两位神经生理方 ...
- iOS 计算时间差
/** * 计算指定时间与当前的时间差 * @param compareDate 某一指定时间 * @return 多少(秒or分or天or月or年)+前 (比如,3天前.10分钟前) */ +(NS ...
- 为什么 Java ArrayList.toArray(T[]) 方法的参数类型是 T 而不是 E ?
前两天给同事做 code review,感觉自己对 Java 的 Generics 掌握得不够好,便拿出 <Effective Java>1 这本书再看看相关的章节.在 Item 24:E ...
- ThinkPHP中通过URL重写隐藏应用的入口文件index.php的相关服务器的配置
[ Apache ] 将httpd.conf配置文件中mod_rewrite.so所在行前面的‘#’去掉 AllowOverride None 将None改为 All 效果图