[Tutor] Simple PassGen

spir denis.spir at free.fr
Mon Feb 9 23:14:17 CET 2009


Le Mon, 9 Feb 2009 13:45:04 -0800,
Marc Tompkins <marc.tompkins at gmail.com> a écrit :

> The print() function adds a newline.  Try this instead - above your loop,
> create an empty string; in place of yor print(), append to the string; at
> the end, print the whole string.
> 
> I'd demonstrate but I'm typing this from my phone.

import random, string
pool = string.digits + string.letters + string.punctuation

pw = ''
for i in range(8):
    pw += random.choice(pool)
print pw

------
la vida e estranya


More information about the Tutor mailing list