Python Forum
Split Bytearray into separate Files by Hex delimter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split Bytearray into separate Files by Hex delimter
#2
Bytearray has a split() method, so you can separate by a hex value.

>>> a = bytearray(b'hello\x93there\x93'*4)
>>> a
bytearray(b'hello\x93there\x93hello\x93there\x93hello\x93there\x93hello\x93there\x93')
>>> a.split(b'\x93')
[bytearray(b'hello'), bytearray(b'there'), bytearray(b'hello'), bytearray(b'there'), bytearray(b'hello'), bytearray(b'there'), bytearray(b'hello'), bytearray(b'there'), bytearray(b'')]
Reply


Messages In This Thread
RE: Split Bytearray into separate Files by Hex delimter - by bowlofred - Mar-08-2023, 08:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Class test : good way to split methods into several files paul18fr 4 699 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  Value error when converting hex value to bytearray shubhamjainj 7 10,973 Mar-20-2023, 05:30 PM
Last Post: Skaperen
  appending to a bytearray Skaperen 21 16,597 Mar-19-2023, 11:05 PM
Last Post: Skaperen
Question Take user input and split files using 7z in python askfriends 2 1,278 Dec-11-2022, 07:39 PM
Last Post: snippsat
  Save multiple Parts of Bytearray to File ? lastyle 1 1,046 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
  bytearray object - why converting to ascii? Chepilo 2 1,944 Nov-21-2022, 07:25 PM
Last Post: Chepilo
  Python Split json into separate json based on node value CzarR 1 6,099 Jul-08-2022, 07:55 PM
Last Post: Larz60+
  importing functions from a separate python file in a separate directory Scordomaniac 3 1,547 May-17-2022, 07:49 AM
Last Post: Pedroski55
  How to save files in a separate directory Scordomaniac 3 2,720 Mar-16-2022, 10:17 AM
Last Post: Gribouillis
  Separate text files and convert into csv marfer 6 3,111 Dec-10-2021, 12:09 PM
Last Post: marfer

Forum Jump:

User Panel Messages

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