[BangPypers] Favorite tips/techniques
Ramchandra Apte
maniandram01 at gmail.com
Tue Sep 10 15:36:58 CEST 2013
Obligatory comic: https://xkcd.com/936/
On 10 September 2013 10:42, Anand Chitipothu <anandology at gmail.com> wrote:
> On Tue, Sep 10, 2013 at 10:39 AM, Shabda Raaj <shabda at agiliq.com> wrote:
>
> > > https://github.com/webpy/webpy/blob/master/web/utils.py#L52
> >
> > Wow, thats better than the "bare" bunch impl. Gonna use it now.
> >
> > Unrelated tip:
> >
> > Here is a one liner I use to generate passwords and other random strings.
> >
> > ''.join(random.choice(string.ascii_uppercase + string.digits) for x in
> > range(N))
> >
>
> I use it very often. Here is my random-password script.
>
> $ cat ~/bin/random-password
> #! /usr/bin/env python
>
> import random
> import sys
> import string
>
> try:
> n = int(sys.argv[1])
> except IndexError:
> n = 20
>
> print("".join(random.choice(string.ascii_letters) for i in range(n)))
>
> Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
More information about the BangPypers
mailing list