-5

("1 34 23 12 -89 11)

How do I make it like this:

['1','34','23','12','-89','11']

This is spaced string which I need to convert to a list.

2 Answers2

2

The split function can do this!

s = '1 34 23 12 -89 11'
l = s.split(' ') # ['1', '34', '23', '12', '-89', '11']
That1Guy
  • 7,075
  • 4
  • 47
  • 59
1

you can use split()

x="1 34 23 12 -89 11"
x.split()

output:

['1','34','23','12','-89','11']