Skip to content

Instantly share code, notes, and snippets.

@acrymble
Created June 30, 2011 13:20
Show Gist options
  • Select an option

  • Save acrymble/1056216 to your computer and use it in GitHub Desktop.

Select an option

Save acrymble/1056216 to your computer and use it in GitHub Desktop.
Python Strings to List
# 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