2

Here is my code:

user_input=input("Enter names separated by commas  ")

ie user_input can now be user_input="Kean,Peter,john".

I need help on how to make the user_input look like this user_input=["kean","Peter","john"]

falsetru
  • 357,413
  • 63
  • 732
  • 636
Bradley Juma
  • 131
  • 13
  • I mean your questions has already been asked, and this is that question. Please check that question's answers, if they're helpful, please mark this question as a duplicate. See [Why are some questions marked as duplicate?](http://stackoverflow.com/help/duplicates). – Remi Guan Dec 16 '15 at 04:48

1 Answers1

1

Using str.split, you can get a list splited by a delimiter:

>>> user_input = "Kean,Peter,john" 
>>> user_input.split(',')
['Kean', 'Peter', 'john']
falsetru
  • 357,413
  • 63
  • 732
  • 636