1 from random import Random 2 3 def random_str(randomlength): 4 str = '' 5 chars = '0123456789-.qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM' 6 length = len(chars) - 1 7 random = Random() 8 for i in range(randomlength): 9 str+=chars[random.randint(0,length)] 10 print str 11 return str 12 random_str(randomlength=255)