>>> data=b\'\\x11\\x22\' >>> data.hex() \'1122\' >>> len(data) 2 #let\'s try to replace data .... >>> data.replace(b\'1122\',b\'3