TypeError: sequence item 0: expected str instance, int found的解决办法
来源:互联网 发布:怎么样找淘宝客户 编辑:程序博客网 时间:2024/05/22 05:25
TypeError: sequence item 0: expected str instance, int found
小例子:
a = ['1','2','3',1]print(' '.join(a))
以为会打印 1 2 3 1
结果报了错
Traceback (most recent call last): File "C:/Users/Administrator/Desktop/onetest.py", line 188, in <module> print(' '.join(a))TypeError: sequence item 3: expected str instance, int found
上网查了资料,说list包含数字,不能直接转化成字符串。
解决办法:
print(" ".join('%s' %id for id in list1))
即遍历list的元素,把他转化成字符串。这样就能成功输出1 2 3 1了。
阅读全文
0 0
- TypeError: sequence item 0: expected str instance, int found的解决办法
- python "".join() 出错TypeError: sequence item 0: expected string
- TypeError: expected bytes, not str
- TypeError: 'str' object does not support item assignment 的解决方法
- TypeError: unorderable types: str() > int()
- found tag Stirng where item is expected解决办法
- android found tag Stirng where item is expected解决办法
- expected but found 'int'
- Python:TypeError: unorderable types: int() < str()
- TypeError: Type str doesn't support the buffer API的解决办法
- Python---TypeError: '<' not supported between instances of 'str' and 'int'
- TypeError: '<' not supported between instances of 'str' and 'int'
- TypeError: unsupported operand type(s) for +: 'int' and 'str'
- TypeError: expected string or buffer的解决方法
- 今天工作的内容found tag String where item is expected
- 报错信息: RuntimeError: tried to construct a tensor from a nested int sequence, but found an item of typ
- XE2 运行时 item not found的解决办法
- Python 3中套接字编程中遇到TypeError: 'str' does not support the buffer interface的解决办法
- Java:二维数组(上)
- 一、HTML【HyperText Markup Language超文本标记语言】简介
- android使用Fragment实现底部菜单使用show()和hide()来切换以保持Fragment状态
- 9.30
- 关于为什么又搬迁回来了
- TypeError: sequence item 0: expected str instance, int found的解决办法
- python matplot 画网格坐标轴方法
- css自定义checkbox
- c中指针与引用的区别
- 反射机制构造实例调用方法
- win10系统安装oracle11g时遇到INS-13001环境不满足最低要求
- 关于ajax的form表单形式 的不稳定性(自己发现的)!!!
- Retrofit的简单封装使用
- C++基础-vector容器