Answers for "split and join in python"

4

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

Code answers related to "split and join in python"

Python Answers by Framework

Browse Popular Code Answers by Language