
python
ltsy
在职
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
io.UnsupportedOperation: not readable
错误解析: f=open("aaa.txt","w",encoding="utf-8") f.write("我在、、") print(f.read()) f 是文件写模式下的,文件读取就会报错 修改: f=open("aaa.txt","w",encoding="utf-8") f.write("我在、、") f.close() f=open("aaa.txt","rt",encoding="u...原创 2019-11-21 09:25:37 · 2176 阅读 · 0 评论 -
【报错管理】can only concatenate str (not "float") to str
报错内容 TypeError: can only concatenate str (not “float”) to str 代码 print("第"+(i+1)+"年在地球重量:"+ a) 报错原因 print()内的“+”前后数据类型保持一致 更正后代码 print("第"+str(i+1)+"年在地球重量:"+ str(a)) ...原创 2019-09-20 17:26:26 · 52242 阅读 · 0 评论