当前位置: 代码迷 >> 综合 >> python syntax error语法错误
  详细解决方案

python syntax error语法错误

热度:88   发布时间:2023-09-20 10:59:50.0

1.    print(print)   TypeError: 'int' object is not callable

print = 3
print(print)

2.coding : utf-8
               ^
SyntaxError: invalid syntax

3.表达式if ...else语句
    缩进 IndentationError: expected an indented block
                                ^
    IndentationError: unindent does not match any outer indentation level
    SyntaxError: invalid syntax 语法错误
    tab != 4个空格
    
    缩进级别必须保持一致

注释
    单行注释 用#
    多行注释用三个单引号或三个双引号 '''被注释的内容'''

UTF-8 = unicode 的扩展集,可变长的字符编码集   
    Assic -->Gb2312 ->gbk1.0-->gb18030
    Assic -->unicode -->utf-8   /utf-16     
    Python2.x == Assic 默认编码
        #!-*- coding:utf-8 -*-
        #coding:utf-8       
    python3.x == unicode默认编码
      
    unicode 是向下兼容gb2312 , gbk

  相关解决方案