Issue
It is a little bit complicated but I have to declare utf-8 coding inside a function, not in the first line of code. It is possible? So I have to do e.g. def fun():
# - * - coding: utf-8 - * -
It seems to not work now.
Solution
No, it is not possible. PEP 263 is quite specific that it has to be done in the first or second line of the file.
It also doesn't make sense. Python reads the whole file in the same encoding. The encoding therefore has to be specified on the file level, at the beginning of the file. You cannot change the encoding from function to function.
Answered By - Roland Weber
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.