欢迎光临
我们一直在努力

Python报错:TypeError: sequence item 0: expected str instance, int found

报错原因:

student_list = [1, 2, 3, 4, 5]

使用” “.join(student_list)时,student_list中的元素都为整数。

 

解决方法:

将student_list中的元素都变为str类型

list(map(str, student_list))

 

关于map函数,跳转:https://www.cnblogs.com/mlllily/p/18069296

 

未经允许不得转载:大有博文 » Python报错:TypeError: sequence item 0: expected str instance, int found
分享到: 更多 (0)

大前端WP主题 更专业 更方便

联系我们联系我们