.split() Qeustion

eschneider92 at comcast.net eschneider92 at comcast.net
Wed Aug 14 00:51:24 EDT 2013


How can I use the '.split()' method (am I right in calling it a method?) without instead of writing each comma between words in the pie list in the following code? Also, is there a way to use .split instead of typing the apostrophes? Thank you.

import random
pie=['keylime', 'peach', 'apple', 'cherry', 'pecan']
print(random.choice(pie))

Eric



More information about the Python-list mailing list