-4
names = "john, maria, william, jenny"

Given the variable names, how to output ['john', 'maria', william', 'jenny']?

fsimoes
  • 67
  • 1
  • 5
  • 4
    Does this answer your question? [How to convert comma-delimited string to list in Python?](https://stackoverflow.com/questions/7844118/how-to-convert-comma-delimited-string-to-list-in-python) – The Grand J Jan 07 '21 at 01:11

1 Answers1

1

You can try str.split() with the argument ", "

>>> names.split(", ")
['john', 'maria', 'william', 'jenny']
ThomasIsCoding
  • 80,151
  • 7
  • 17
  • 65