If I have a list of chars:
(如果我有一个字符列表:)
a = ['a','b','c','d']
How do I convert it into a single string?
(如何将其转换为单个字符串?)
a = 'abcd'
Use the join method of the empty string to join all of the strings together with the empty string in between, like so:
join
(使用空字符串的join方法将所有字符串与空字符串连接在一起,如下所示:)
>>> a = ['a', 'b', 'c', 'd'] >>> ''.join(a) 'abcd'
1.4m articles
1.4m replys
5 comments
57.0k users