Correct way to define Python source code encoding

后端 未结 6 1746
孤街浪徒
孤街浪徒 2020-11-22 12:15

PEP 263 defines how to declare Python source code encoding.

Normally, the first 2 lines of a Python file should start with:

#!/usr/bin/python
# -*- c         


        
6条回答
  •  -上瘾入骨i
    2020-11-22 12:35

    Just copy paste below statement on the top of your program.It will solve character encoding problems

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    

提交回复
热议问题