📜  python代码示例中的拆分和加入

📅  最后修改于: 2022-03-11 14:45:19.243000             🧑  作者: Mango

代码示例1
>>> a = "this is a string"
>>> a = a.split(" ") # a is converted to a list of strings. 
>>> print a
['this', 'is', 'a', 'string']

>>> a = "-".join(a)
>>> print a
this-is-a-string