I have a file in .ktx format. I have opened the file in 'rb' mode. I want to modify particular bytes in that file. I am reading bytes using read(4) [ i want to read number which is of 4 bytes], call and convert each chunk into a number. What I want is, to increase that number by specific number and insert it back into file stream. Is there any function in python which converts a byte string to an integer? I tried with int() but it prints some binary data.
my code:
bytes=file.read(4)
for char in bytes:
print hex(ord(char))