Python Forum
Correct way to change bytes in a file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct way to change bytes in a file?
#6
(Feb-22-2017, 02:11 PM)snippsat Wrote: [python]>>> b_string = b'\x76\x12\x0B\x08'
>>> [id(i) for i in b_string]
[1400293216, 1400291616, 1400291504, 1400291456]
The difference between ids and addresses make me believe that the 'i' elements you get are already copies of the bytes in the sequence...
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Messages In This Thread
What is actually stored in memory? - by Raptor88 - Feb-22-2017, 10:49 AM
RE: What is actually stored in memory? - by Mekire - Feb-22-2017, 10:59 AM
RE: What is actually stored in memory? - by Ofnuts - Feb-22-2017, 11:41 AM
RE: What is actually stored in memory? - by wavic - Feb-22-2017, 11:54 AM
RE: What is actually stored in memory? - by Ofnuts - Feb-22-2017, 04:50 PM
RE: What is actually stored in memory? - by wavic - Feb-22-2017, 07:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I write formatted (i.e. bold, italic, change font size, etc.) text to a file? JohnJSal 13 29,220 May-20-2025, 12:26 PM
Last Post: hanmen9527
  [SOLVED] [Linux] Write file and change owner? Winfried 6 1,851 Oct-17-2024, 01:15 AM
Last Post: Winfried
  Extracting the correct data from a CSV file S2G 6 2,089 Jun-03-2024, 04:50 PM
Last Post: snippsat
  What does .flush do? How can I change this to write to the file? Pedroski55 3 1,553 Apr-22-2024, 01:15 PM
Last Post: snippsat
Question [SOLVED] Correct way to convert file from cp-1252 to utf-8? Winfried 8 11,431 Feb-29-2024, 12:30 AM
Last Post: Winfried
  logging: change log file permission with RotatingFileHandler erg 0 2,721 Aug-09-2023, 01:24 PM
Last Post: erg
  How can I change the uuid name of a file to his original file? MaddoxMB 2 2,400 Jul-17-2023, 10:15 PM
Last Post: Pedroski55
  Change HID bytes using pywinusb.hid Stealthrt 0 1,650 Jul-06-2023, 03:36 PM
Last Post: Stealthrt
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 1,725 Feb-15-2023, 05:34 PM
Last Post: zsousa
  find some word in text list file and a bit change to them RolanRoll 3 2,540 Jun-27-2022, 01:36 AM
Last Post: RolanRoll

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020