Re: Print word from list

2013-08-03 Thread Steven D'Aprano
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

Re: Print word from list

2013-08-03 Thread eschneider92
Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Print word from list

2013-08-03 Thread Chris Angelico
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

Print word from list

2013-08-03 Thread eschneider92
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