1

I have a string like this

string_ = 'hello world, world, hello, stackoverflow, me, not, me'

How to change it into a list like this?

['hello world', 'world', 'hello', 'stackoverflow', 'me', 'not', 'me']

I have try

alist = list(string_)

but when I format alist It shows

['h', 'e', 'l', ... ]
jianbing Ma
  • 355
  • 1
  • 3
  • 15

1 Answers1

2

This should do the trick:

alist = string_.split(', ')
pp_
  • 3,435
  • 4
  • 19
  • 27