How to use python change a string into list cut by ','? -
this question has answer here:
i have string
string_ = 'hello world, world, hello, stackoverflow, me, not, me'
how change list this?
['hello world', 'world', 'hello', 'stackoverflow', 'me', 'not', 'me']
i have try
alist = list(string_)
but when format alist
shows
['h', 'e', 'l', ... ]
this should trick:
alist = string_.split(', ')
Comments
Post a Comment