If I have a string:
a = 'hello'
How do I convert it into a list?
a = ['h', 'e', 'l', 'l', 'o']
A string is an iterable, and a list can be constructed from an iterable. So all you need is
a = list(a)
print(a)
Output:
['h', 'e', 'l', 'l', 'o']
Tried to do it differently
Code:
map(None,"sart")#for python 2.x
#list(map(None,"sart")) for python 3.x
Output:
['s', 'a', 'r', 't']