I wanted to read last 50 bytes from a file.
I've used the following code to read first 50 bytes.
def read_file(filepath):
open_file = open(filepath)
return "".join("{:02x}".format(int(ord(c))) for c in open_file.read(50))
I wanted to read last 50 bytes from a file.
I've used the following code to read first 50 bytes.
def read_file(filepath):
open_file = open(filepath)
return "".join("{:02x}".format(int(ord(c))) for c in open_file.read(50))