[Tutor] Clunky Password maker

naheed arafat naheedcse at gmail.com
Thu May 26 07:12:16 CEST 2011


On Wed, May 25, 2011 at 11:25 PM, Wolf Halton <wolf.halton at gmail.com> wrote:

> Is there a less clunky way to do this?
> [code]
> def new_pass():
>     series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-',
> '=', \
>               '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_',
> '+', \
>               'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
> '\\', \
>               'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
> '|', \
>               'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', "'", \
>               'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', \
>               'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', \
>               'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?']
>
>
> well. i would have made the series list as follows:
 >>> a=[chr(i) for i in range(33,127)]
>>> a
['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/',
 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>',
'?',
 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O',
 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
'_'
, '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o'
, 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~']
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110526/1b939e16/attachment.html>


More information about the Tutor mailing list