How do I display unicode value stored in a string variable using ord()

Paul Rubin no.email at nospam.invalid
Sun Aug 19 14:20:11 EDT 2012


Ian Kelly <ian.g.kelly at gmail.com> writes:
>>>> sys.getsizeof(bytes(range(256)).decode('latin1'))
> 329

Please try:

   print (type(bytes(range(256)).decode('latin1')))

to make sure that what comes back is actually a unicode string rather
than a byte string.



More information about the Python-list mailing list