[Tutor] Codec lookup, was Re: name shortening in a csv module output

Jim Mooney cybervigilante at gmail.com
Sat Apr 25 16:56:26 CEST 2015


>
> Hm, who the heck uses "u8"? I'd rather go with
>
> >>> encodings.aliases.aliases["steven_s_preferred_encoding"] = "utf_8"
> >>> "Hello".encode("--- Steven's preferred encoding ---")
> b'Hello'
>
> ;)
>

Peter Otten

> __
>

Or normalize almost any mistyping ;'):

>>> encodings.normalize_encoding('utf&&$%##8')
'utf_8'

-- 
Jim

If you only had one hour left to live, would you spend it on Facebook,
Twitter, or Google Plus?


More information about the Tutor mailing list