python报错 can only concatenate str (not “int”) to str

python报错 can only concatenate str (not “int”) to str

Traceback (most recent call last):

File "i:/pythonlearn/autoupload.py", line 47, in <module>

print('结余待颁布数目' + len(file_list))

TypeError: can only concatenate str (not "int") to str

python在做拼接的功夫,不许机动把典型变换为string典型;须要举行典型变换,比方将print(1+"a")改为print(str(1)+"a")就不妨了;

以是上书面典型缺点须要改为 print(‘结余待颁布数目’ + str(len(file_list)))

分享到 :
相关推荐

Leave a Reply

Your email address will not be published. Required fields are marked *