【发布时间】:2023-02-06 22:03:40
【问题描述】:
如何将字符串列表连接成单个字符串?
例如,给定['this', 'is', 'a', 'sentence'],我如何得到"this-is-a-sentence"?
用于处理一些字符串单独的变量,请参阅How do I append one string to another in Python?。
对于相反的过程——从字符串创建列表——请参阅How do I split a string into a list of characters?或How do I split a string into a list of words?。
【问题讨论】:
标签: python string list concatenation