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
  • 3,724
  • 9
  • 43
  • 76

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
  • 18,126
  • 7
  • 21
  • 33