"Richard D. Moores" <[email protected]> wrote
import os
os.urandom(6)
b'\xd1\xfc\xb0\x14\xeaL'
So what is this output? What in ascii? What in hex? Do those
questions even make sense?
The documentation tells you:
os.urandom(n)ΒΆ
Return a string of n random bytes suitable for cryptographic use.
So its a string of 5 bytes(*) generated at random by some random
generator function in your OS. What do you not understand?
What did you expect?
Python is telling you its bytes with the b at the front.
The \x tells you they are hex values.
(*)The fact its 5 is odd since you seem to pass 6 as an argument!
When I try it I get 6 bytes back.
Does that help?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor