ts7758258 发表于 2018-8-9 08:25:28

编码部分历史及python文件编码简介

  UTF-8 = unicode的扩展集,可变长的字符编码集
  ascii --> gb2312 --> gbk1.0 -->gb18030
  ascii --> unicode --> utf-8
  Python2.x == ascii是其默认编码
  如果在2.x中需要使用utf-8,需要以下声明:
  #!-*- coding:utf-8 -*-
  #coding:utf-8
  Python3.x == unicode是其默认编码
  unicode是向下兼容gb2312和gbk
页: [1]
查看完整版本: 编码部分历史及python文件编码简介