Joining byte list with python Joining byte list with python python python

Joining byte list with python


Perform the join on a byte string using b''.join():

>>> b''.join([b'line 1\n', b'line 2\n'])b'line 1\nline 2\n'


Just work on your "lines" and write them out as soon as you are finished with them.

file = open('myFile.exe', 'r+b')outfile = open('myOutfile.exe', 'wb')for line in f:    #Here you are going to mutate the CURRENT line.    outfile.write(line)file.close()outfile.close()