Answers for "python splitting and joining"

5

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
Posted by: Guest on July-16-2020

Python Answers by Framework

Browse Popular Code Answers by Language