Reading formatted text using python,g.write('# comment\n')