python - 如何将列表元素转为字符串?

标签 python string list

如果这是一个重复的问题,我很抱歉,但我是 Python 新手,不确定如何询问我需要的东西。从最基本的意义上来说,我想改变这一点:

a = ['10', '20', '30']

编辑:

实际上:

a = [10, 20, 30]

进入

a = ['102030']

非常感谢您的帮助!

最佳答案

怎么样,

a = ''.join(a)
a = [a]  # if you want to put the string into a list

同样的问题:How to collapse a list into a string in python?

关于python - 如何将列表元素转为字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43904854/

相关文章:

python - 'str' 对象不能被解释为 python 中的整数

Python:用于 Python2.7 和 Python3.x 的最新 GUI 调试器,没有 IDE

java - 为什么 char[] 优于 String 作为密码?

c++ - 准备 C++ Json 请求

R 对列表的元素求和而不获取数字(0)

python - 没有异常时将回溯打印到文件

python - 如何在 Python + MySQL 中使用条件语句?

javascript - 将 JavaScript for 循环集成到自定义函数中

c# - 如何在同时删除项目的同时遍历列表?

c++ - 调用 C++ 容器的 size() 函数的运行时间是多少