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()]