I would like to modify a file containing a hex dump. There are 33 lines which contain strings like this: 0000000000000000b00b8000c7600795 0001906da451000000008fac0b000000 I would like to put two spaces after every two characters, like this: 00 00 00 00 00 00 00 00 b0 0b 80 00 c7 60 07 95 So far I've made this script that works, but it puts two spaces in each character. I can't see what parameter I can use with .join() to make it every two characters: import os os.rename( 'hex_dump.txt', 'hex_dump.old' ) destination = open( 'hex_dump.txt', "w" ) source = open( 'hex_dump.old', "r" ) for line in source: if len(line) > 2: destination.write(" ".join(line)) source.close() destination.close() Continue reading...