How can we convert a list of characters into a string in Python?

PythonServer Side ProgrammingProgramming

Python has an in-built join() function that returns a string by joining elements in a sequence object by inserting separator between elements. If we need a string without any separator, we initialize it with null string

>>> lst=['h','e','l','l','o']
>>> str=''
>>> str.join(lst)
'hello'
raja
Published on 01-Jan-2018 19:31:39
Advertisements