原文:python list轉換字符串報錯TypeError: sequence item 0: expected str instance, int found

list包含數字,不能直接轉化成字符串。 解決辦法:print .join s id for id in list ...

2018-01-06 11:42 1 4990 推薦指數:

查看詳情

Python 列表list字符串str 互轉

一、列表list字符串str 命令(python2.x):''.join(list) 命令(python2.x):''.join(str(s) for s in list) 其中,引號中是字符之間的分割符,如“,”,“;”,“\t”,“*”等等 我的電腦是python ...

Wed Nov 14 18:23:00 CST 2018 0 3046
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM