python - Can't print os.urandom() -


i have following problem. trying print output of os.urandom(10) , nothing in output. have found workaround printing repr of os.urandom weird considering actual type of os.urandom string.

does have same problem or knows why happens? using python 2.7 on spyder , below copy of phenomenon:

>>> import os >>> out = os.urandom(10) >>> print out >>> out '\x96\x02\x1b\xa9\xa2z\xc4\xf0\xa4\xfa' >>> type(out) <type 'str'> >>> print repr(out) '\x96\x02\x1b\xa9\xa2z\xc4\xf0\xa4\xfa' 

those non-printing characters. it's not reasonably possible print them as-is. if want take hexdump, use binascii.hexlify().


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -