pythonpython-3.xhexbinaryfileshex-editors

What does mean those kinds like "% U+R m" in hexadecimal


I tried to read mkv video binary reading with python, so my code was:

a = open("vokoscreen-2019-12-21_12-15-11.mkv","rb")
a.read()

and got a big result, this is little bit part

W0I\xfb\xd4\x95l\xcfG\xa1\xa0\xb20\x9a\xb6\xa9\xbc\xa2\xdd\xc5\x9b}\x17e\xc2q\xa8d\x94\xda\x91\xd5F\xb9\xcbW2QK+p/\xc0\xd9\xf4D\x84\xda\xcb\xa7\xd42(b\r\x8f\x10\xb5\x84\xb0\x8f\xe3,\xaaf\xcfkd\xcf\xdb(}\xcf\tp\x84\xde\xb2l\xbfZ\xc8\xcc\x03+\xfe7;\x816\xa8sh] m\

my question is what is ( } in xdb(} ?, what is this xcbW2QK+p ?, what is ] in this xa8sh] . thanks .


Solution

  • Python bytes literals display the printable ASCII character that corresponds to the byte's value if such a character exists, otherwise the escaped hex value is displayed.

    For example:

    >>> # Inside the ASCII range but unprintable
    >>> b'\x01'
    b'\x01'
    
    >>> # Inside the ASCII range and printable
    >>> b'\x36'
    b'6'
    
    >>> # Outside the ASCII range
    >>> b'\x91'
    b'\x91'
    

    The language reference comments:

    [Bytes literals] may only contain ASCII characters; bytes with a numeric value of 128 or greater must be expressed with escapes.