久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

解決Python 異常TypeError: cannot concatenate 'str' and 'int' objects

瀏覽:4日期:2022-07-30 17:22:37

TypeError: cannot concatenate ’str’ and ’int’ objects

print str + int 的時候就會這樣了

python + 作為連接符的時候,不會自動給你把int轉換成str

補充知識:TypeError: cannot concatenate ’str’ and ’list’ objects和Python讀取和保存圖片

解決Python 異常TypeError: cannot concatenate

運行程序時報錯,然后我將list轉化為str就好了。

解決Python 異常TypeError: cannot concatenate

利用’’.join(list)

如果需要用逗號隔開,如1,2,3,4則使用’,’.join(list)

解決Python 異常TypeError: cannot concatenate

Python中plt可以顯示和保存圖片,不能使用mping

import matplotlib.image as mpimg # mpimg 用于讀取圖片

開頭import時加入

import matplotlib.pyplot as plt

from PIL import Image

打開用open(’路徑’)

保存用a.save(’路徑’)

以上這篇解決Python 異常TypeError: cannot concatenate ’str’ and ’int’ objects就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Python 編程
主站蜘蛛池模板: 永泰县| 甘泉县| 红桥区| 教育| 文安县| 阿拉尔市| 固阳县| 岳普湖县| 天门市| 高碑店市| 宜良县| 土默特右旗| 鄄城县| 云林县| 邵武市| 阿克陶县| 遂川县| 从江县| 商洛市| 凤台县| 宜春市| 卢湾区| 兴义市| 石屏县| 连平县| 莱州市| 冷水江市| 新龙县| 沙坪坝区| 平顶山市| 荆门市| 兰西县| 社会| 合川市| 遂昌县| 盐边县| 青阳县| 澎湖县| 静安区| 濮阳市| 和政县|