email with a non-ascii charset in Python3 ?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Aug 15 19:54:54 EDT 2012


On Wed, 15 Aug 2012 17:57:47 +0100, MRAB wrote:

>> #!/usr/bin/python3
>> #_*_ coding: latin1 _*_
>>
> Aw well as the other replies, the "coding" line should be:
> 
> #-*- coding: latin1 -*-


I don't believe that actually matters to Python. It may matter to Emacs 
or some other editors, but Python simply matches on this regex:

coding[=:]\s*([-\w.]+)

http://docs.python.org/py3k/reference/lexical_analysis.html#encoding-declarations


-- 
Steven



More information about the Python-list mailing list