Python2不支持中文的问题解决方法

  1.创建*.py程序

  2.运行python程序

      1)python 文件名(用Python2版本运行)

      2)python3 文件名 (用Python3版本运行)

PS:由上图可知,Python2不支持中文,解决方法接着往下看

  3.解决方案(二选一)

     1)(新手)在文件首行添加:#coding=utf-8

     2)(官方推荐)在文件首行添加:-*- coding:utf-8 -*-

 

猜你喜欢

转载自blog.csdn.net/qq_42168575/article/details/81147854