Another approach. You do not need to format an int to get it.
import random import string def random_string(length): pool = string.letters + string.digits return ''.join(random.choice(pool) for i in xrange(length))
Gives you flexibility regarding string length.
>>> random_string(64) 'XTgDkdxHK7seEbNDDUim9gUBFiheRLRgg7HyP18j6BZU5Sa7AXiCHP1NEIxuL2s0'
Matthew Taylor Jan 25 '12 at 22:10 2012-01-25 22:10
source share