with open("savefile.dat", "r+b") as f: f.seek(0x1A4) # Offset where gold is stored f.write(b'\xFF\xFF') # Set gold to 65535