+ 1

How convert a string in list of its character

For example hello =('h','e','l','l','o')

20th Sep 2019, 3:20 PM
harsh
harsh - avatar
2 odpowiedzi
+ 7
print(list('hello')) # output: ['h', 'e', 'l', 'l', 'o']
20th Sep 2019, 3:52 PM
Lothar
Lothar - avatar
+ 3
Firstly print(tuple('hello')) =('h','e','l','l','o') #it mean it is tuple not list #for making list print(list('hello')) =['h', 'e', 'l', 'l', 'o')] #so it is list
20th Sep 2019, 4:07 PM
Abhishek Kushwaha
Abhishek Kushwaha - avatar