I have a little problem: why does this code
somefile = open(\'foo.txt\', \'w\') somefile.write(\'0B0B0B\'.decode(\'hex\')) somefile.close()
It comes from the \n -> \r\n transformation due to the fact that you're running on Windows. Open the file in binary mode ('wb') if you want to avoid this.
\n
\r\n
'wb'