On Sat, 03 Aug 2013 15:17:42 -0700, eschneider92 wrote:
> pie='apple keylime pecan meat pot cherry'
That sets pie to a string containing multiple words.
> pie.split()
This splits pie into individual words, then immediately throws the result
away, leaving pie still set to a string. Instead, you
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Aug 3, 2013 at 11:17 PM, wrote:
> pie='apple keylime pecan meat pot cherry'
> pie.split()
>
> How can I print a word from the list other than this way: print(pie[0:5]) ?
The split() method returns a list, it doesn't change the original string. Try:
pies = pie.split()
print(pie[2])
Ch
pie='apple keylime pecan meat pot cherry'
pie.split()
How can I print a word from the list other than this way: print(pie[0:5]) ?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list