By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 2,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

Getting text into list?

P: 21
Hey all im wondering if there is a way to take user input in format of a sentence and store it in the list by word. So like take text input and then each word in the input becomes an entry in a list. Any help?

code [python]
Apr 7 '09 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 2,851
Expand|Select|Wrap|Line Numbers
  1. >>> s = 'This is a sentence'
  2. >>> s.split()
  3. ['This', 'is', 'a', 'sentence']
  4. >>> 
Apr 7 '09 #2

P: 21
why thank you good sir
Apr 7 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.