Skip to content

Instantly share code, notes, and snippets.

@SZanlongo
Created September 18, 2014 02:03
Show Gist options
  • Save SZanlongo/60a9c0a0a605f950331e to your computer and use it in GitHub Desktop.
Save SZanlongo/60a9c0a0a605f950331e to your computer and use it in GitHub Desktop.
Get integers from a string (space seperated)
# https://stackoverflow.com/questions/691946/short-and-useful-python-snippets
S = "1 2 2 3 3 3 4 4 4 4"
print [int(x) for x in S.split()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment