s = sha1(random()).hexdigest()

gert gert.cuykens at gmail.com
Fri Jan 16 19:14:19 EST 2009


On Jan 16, 7:08 am, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> >  s = urandom(10).encode('hex')
>
> >  AttributeError: 'bytes' object has no attribute 'encode'
>
> py> binascii.hexlify(os.urandom(10))
> b'92b91d5734a9fe562f23'
>

sqlite3

 s = hexlify(urandom(10))
 db.execute('SELECT sid FROM sessions WHERE sid=?',(s))

('SELECT sid FROM sessions WHERE sid=?', b'c916f03d441a0b2b5a9d')
[error] Incorrect number of bindings supplied. The current statement
uses 1, and there are 20 supplied.

???



More information about the Python-list mailing list