Python 3.x 学习笔记

 字符集编码

    Python 2.x 默认字符集 ASCII
    Python 3.x 默认字符集 utf-8

  指定字符集两种方式:

    # -*- coding:utf-8 -*-
    # coding:utf-8

 变量设置规范(建议):

    变量:全小写,用下划线分词。

    常量:全大写,用下划线分词。

      例如:

  

 字符串:

  • 自然字符串, 通过在字符串前加r或R。 如 r"this is a line with " 则 会显示,并不是换行。
  • python允许处理unicode字符串,加前缀u或U, 如 u"this is an unicode string"。
原文地址:https://www.cnblogs.com/jc000000/p/6909667.html