• python入门常见错误


    1.IndentationError: unindent does not match any outer indentation level

    使用的缩进方式不一致,有的是 tab 键缩进,有的是空格缩进,改为一致即可。

    2.IndentationError: unexpected indent 

    python编译器是在告诉你"Hi,老兄,你的文件里格式不对了,可能是tab和空格没对齐的问题",所有python对格式要求非常严格。

    因此,在Python的代码块中必须使用相同数目的行首缩进空格数。

    3.运行时出现NameError: name 'raw_input' is not defined

    python3.x系列不再有 raw_input 函数。3.x中换成input即可。

    4.fh = open("testfile.txt", "wb")运行时报错“TypeError: 'str' does not support the buffer interface”

       fh = open("testfile.txt", "w")正常运行          why?

  • 相关阅读:
    “Metro”,移动设备视觉语言的新新人类
    三个排序
    window.location.reload;刷新
    2012年7月4日
    PDO基础(一)
    php数组
    smarty(原理概述)
    php函数
    jquery Poshy Tip
    WAMP:PHP基础(一)
  • 原文地址:https://www.cnblogs.com/duoduo--up/p/5019519.html
Copyright © 2020-2023  润新知