On Sun, Jan 12, 2014 at 11:16:37PM +1000, Nick Coghlan wrote: > > content = '\n'.join([ > > 'header', > > 'part 2 %.3f' % number, > > binary_image_data.decode('latin-1'), > > utf16_string.encode('utf-16be').decode('latin-1'), > > 'trailer']).encode('latin-1') > > Why are you proposing to do the *join* in text space? In defence of that, doing the join as text may be useful if you have additional text processing that you want to do after assembling the whole string, but before calling encode. Even if you intend to encode to bytes at the end, you might prefer to work in the text domain right until just before the end: - no need for b' prefixes; - indexing a string returns a 1-char string, not an int; - can use the full range of % formatting, etc. -- Steven
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4