On 9/12/10 4:14 AM, Stef Mientki wrote:
  hello,

Is it possible to get the encoding of a python file from the first source line,
(if there's any),
after importing it ( with '__import__' )

# -*- coding: windows-1252 -*-

The regular expression used to match the encoding declaration is given here:

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

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to