0

Here is the relevant code:

FfFe = (65534).to_bytes(2, byteorder="big")
    
Data = b'\xff\xfeD\x00y\x00n\x00a\x00m\x00i\x00c\x00 \x00R\x00a\x00n\x00g\x00e\x00 \x00(\x00D\x00R\x00)\x00\x00\x00\xff\xfe1\x001\x00\x00\x00'

Lines = Data.split(FfFe)

Here is what shows up after the split:

Lines = {list:3}[b'', b'D\x00y\x00n\x00a\x00m\x00i\x00c\x00 \x00R\x00a\x00n\x00g\x00e\x00 \x00(\x00D\x00R\x00)\x00\x00\x00', b'1\x001\x00\x00\x00'] 
 0 = {bytes:0}b''
 1 = {bytes:38}b'D\x00y\x00n\x00a\x00m\x00i\x00c\x00 \x00R\x00a\x00n\x00g\x00e\x00 \x00(\x00D\x00R\x00)\x00\x00\x00'
 2 = {bytes:6}b'1\x001\x00\x00\x00'

Where does lines[0] come from?

dawg
  • 98,345
  • 23
  • 131
  • 206
  • It starts with the delimiter, so this seems expected. It isn't fundamentally different from `'/a/b/c'.split('/')` being `['', 'a', 'b', 'c']` and having `''` as its first element. What do you expect Python to do here? – John Coleman Apr 02 '21 at 15:45
  • I now understand what it is doing. All the documentation I have found so far did not mention that was the result. I also found a years old similar question with a solution that prrovided a more consistant outcome. – GrandSean Apr 03 '21 at 21:23

0 Answers0