Reputation: 225
I know that:
print(list('Hello'))
will print
['H', 'e', 'l', 'l', 'o']
and I know that
print(list('Hello world!'))
will print
['Hello', 'world!']
What syntax would be easiest to get:
['H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!']
Upvotes: 1
Views: 36780
Reputation: 231
work under python 3.6
a = "Hello world!"
listresp = list(map(list, a))
listff =[]
print (listresp)
for charersp in listresp:
for charfinnal in charersp:
listff.append(charfinnal)
print (listff)
['H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!']
Upvotes: 2