Python: How to generate a random string with letters and numbers

This is probably one of the shortest and simplest implementations I've seen in any language. Nice work MasterPi !

import string
import random

"".join([random.choice(string.letters+string.digits) for x in range(1, desired_length)])

[ Source ]

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog