List Shortcut
- April 21st, 2012
- Posted in FAQs
- By arlis.hoglen
- Write comment
When creating a list, you can skip adding all the quotes around and commas between elements of the list. Let Python do it for you by creating a string then convering it to a list using the .split() method.
>>> cheeses= “cheddar gouda swiss”.split()
>>> cheeses
['cheddar', 'gouda', 'swiss']
Jon M. for his contribution
