Python 2

作者: ayalamih | 来源:发表于2015-12-17 10:04 被阅读66次

    针对Python2.x中
    Python中默认的编码格式是ASCII格式,在没修改编码格式时无法正确打印汉字。解决办法为只要在文件开头加入 #-- coding: UTF-8 --或者#coding=utf-8就可以了.
    在Python3.x中源码文件默认使用utf-8编码,无需指定utf-8编码.

    IndentationError: expected an indented block错误,是python编译器告诉你的文件里格式不对,可能是tab和空格没对齐。
    IndentationError: unindent does not match any outer indentation level错误表明,你使用的缩进方式不一致,有的是 tab 键缩进,有的是空格缩进,改为一致即可。

    Python标准数据类型:
    Numbers(数字)
    String(字符串)
    List(列表)
    Tuple(元组)
    Dictionary(字典)

    相关文章

      网友评论

          本文标题:Python 2

          本文链接:https://www.haomeiwen.com/subject/mihphttx.html