split join in python code example
Example: split and join in python
>>> 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
>>> 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