-1

Suppose I get input as apple, how can I split it in list of each character like ['a','p','p','l','e']?

I tried [i for i in input().split('')],

but it outputs error: ValueError: empty separator.

Adi219
  • 4,712
  • 2
  • 20
  • 43
coluloci
  • 3
  • 1
  • 2
  • 1
    Just do `list('apple')`. – shad0w_wa1k3r Aug 19 '17 at 10:39
  • @coluloci Once you have found an answer which works for you, please click the tick next to that answer to accept it. This lets other people with your problem know which solution works for you. – Adi219 Aug 19 '17 at 10:42

1 Answers1

4

Try list('apple').

This will split the string 'apple' into individual characters and place them inside a list.

Output:

['a','p','p','l','e']
Adi219
  • 4,712
  • 2
  • 20
  • 43