0

I have a word:

'shrewd'

How can I convert it into:

['s','h','r','e','w','d']

I have tried:

delim = ','

x = 'shrewd'.split(delim)

x

But not working ,any friend can help ?

William
  • 2,621
  • 5
  • 32
  • 62

1 Answers1

1

There aren't any commas in your string, so you won't be able to get your desired output using .split().

Since strings are iterable, you can use:

data = 'shrewd'
print(list(data))

This outputs:

['s', 'h', 'r', 'e', 'w', 'd']
BrokenBenchmark
  • 13,997
  • 5
  • 12
  • 27