I was trying to come up with a random collection of characters and upon searching to see if such a list already existed I found this link:
http://stackoverflow.com/questions/2257441/python-random-string-generation-with-upper-case-letters-and-digits
Which is all fine and good but when I tried it I set it up a little different. I set it up as such:
My code gives me no output but the one linked does. Am I not understanding something about the code and strings in general?
http://stackoverflow.com/questions/2257441/python-random-string-generation-with-upper-case-letters-and-digits
Which is all fine and good but when I tried it I set it up a little different. I set it up as such:
import random, string
def idgen(size=8, chars=string.ascii_letters + string.digits):
newpass = ''
for x in range(size):
newpass.join(random.choice(chars))
return newpass
print(idgen())
My code gives me no output but the one linked does. Am I not understanding something about the code and strings in general?