[Tutor] os.urandom()

Richard D. Moores rdmoores at gmail.com
Sun Aug 8 01:47:26 CEST 2010


On Sat, Aug 7, 2010 at 15:01, Dominik Danter <dotti at socialnerds.org> wrote:

> You could try something like binascii.hexlify(os.urandom(6)) to create hex.

>>> os.urandom(6)
b'f\xc8rnr\xea'
>>> binascii.hexlify(b'f\xc8rnr\xea')
b'66c8726e72ea'
>>> os.urandom(6)
b'D\xe9?\xda\xd80'
>>> binascii.hexlify(b'D\xe9?\xda\xd80')
b'44e93fdad830'

Thanks, but I'm not sure what to do with that..

What I am now sure of, is that I'm multiple steps ahead of myself with
os.urandom() !

Dick


More information about the Tutor mailing list