On Sun, 28 Sep 2008 19:03:42 +1300, Lawrence D'Oliveiro wrote:

> In message
> <[EMAIL PROTECTED]>, est
> wrote:
> 
>> The problem is, why the f**k set ASCII encoding to range(128) ????????
> 
> Because that's how ASCII is defined.
> 
>> while str() is internally byte array it should be handled in range(256)
>> !!!!!!!!!!
> 
> But that's for random bytes. How would you convert an arbitrary object
> to random bytes?

from random import randint
''.join(chr(randint(0, 255)) for i in xrange(len(input)))

of course. How else should you get random bytes? :)



-- 
Steven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to