For the password entry field of an email client that I am making, I thought that it would be cool to have the password show random characters. Since I don't want to write down a dictionary of all ascii characters, I was wondering if there is a module which I could import to get it. My idea of the code looks like this:
import random
import char_set #All ascii characters
def random_char():
char_select = random.randrange(len(char_set))
char_choice = char_set[char_select]
return char_choice
NOTE: This must be cross-platform as I run on Mac OSX, Windows, and Debian (Raspberry Pi).