How do I read one and only one byte from a binary file at a specified position?

binary-data, binaryfiles, byte, python

Solution

Using seek and read, as show below should allow you to read one byte at a given position:

f.seek(10)
f.read(1)

Problem

I am wondering if it is possibly to read one byte at one given position at a time in python. I know about `file.read(``any number``)`, but I want something that returns the byte I specify and ONLY the byte I specify. If I write: `file.read(10)`, it reads the first 10 bytes of the file. How do I say read byte 10 and only return byte 10? (this must work with all numbers greater than one) also, no classes please!

Original source

Related problems