Dave Angel wrote:
def separateToList(num):
    """
    changes an integer 0-255 into a list of ints, size exactly 3
    """
    return map(int, list(format(num, "03d")))

Nice!

Note that the "list" conversion is not needed; when you iterate over a string you automatically get each character in turn:

map(int, ("%03d" % num))


Albert
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to