Created
June 30, 2011 13:20
-
-
Save acrymble/1056216 to your computer and use it in GitHub Desktop.
Python Strings to List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # string-to-list.py | |
| # some strings | |
| s1 = 'hello world' | |
| s2 = 'howdy world' | |
| # list of characters | |
| charlist = [] | |
| for char in s1: | |
| charlist.append(char) | |
| print charlist | |
| # list of 'words' | |
| wordlist = s2.split() | |
| print wordlist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment