python编译错误的积累
来源:互联网 发布:linux mysql 源码安装 编辑:程序博客网 时间:2024/06/05 18:18
1、代码编辑时的常见错误:
- 1、unindent does not match any outer indentation level
- 有的语句的缩进不是用tab,而是直接用了几个空格代替编译时出了问题
- 2、IndentationError:expected an indented block错误解决
- 有空格或缩进错误
- 3、syntaxError:Non-ASCII character ‘\xe8’ in file…:
- 在文件的开头添加下面的两行
#!/usr/bin/env python # coding=utf-8
2、常见的语法上的错误:
- 1、for模块、函数定义模块等要加‘:’
- 2、python3.x的版本的python要用print(a) ,即加括号,不用print a
- 3、对象不能作为字典的键值key
3、IO上常见的错误:
- 1、读入外部数据需要读入字节数据时,出现TypeError: must be str, not bytes
- open(filename, ‘w’)改为open(filename, ‘wb’)
- 同理,fr = open(filename, ‘rb’)
- 2、使用python自带的open()函数打开txt文件,出现valueError:embedded null character
- 不要以纯数字作为txt文件的开头
4、其他
- 1、TypeError: ‘dict_keys’ object does not support indexing
- python2中,dict.key()返回的是list;而python3中返回的是dict_key对象,故需要变成如:list(myTree.keys())[0]
0 0
- python编译错误的积累
- codeblocks各种编译错误积累
- QT让人纠结的编译错误【积累】
- Keil C51编译错误警告解决方法积累
- Keil MDK编译错误警告积累贴
- Keil uVision(MDK)编译错误积累
- 我的python积累
- python 的积累
- 【7】编译python时出现的错误
- MySQL-python编译错误的问题
- uboot 编译的一点积累
- python编译错误总结
- 汇编语言中 编译 连接 构建时的一些错误以及错误的修正方法(不断积累中...)
- python的一些技术积累
- 错误积累
- 错误积累
- 错误积累
- 错误积累
- PHP入门学习笔记之—— PHP 类与对象 (中)
- 多线程系列:一介绍
- 使用svn时,报证书验证错误Error validating server certificate for
- 内建与外联css与js的优劣
- Land oj 1611 - Null (水)
- python编译错误的积累
- 迭代器Iterator接口
- PHP入门学习笔记之—— PHP 类与对象 (下)
- 从工程师到Leader成长之路
- C. Hard Process
- C 【函数 递归】
- SQLiteOpenHelper类的简化操作数据库(api查询方式)
- hdu1098(基础)
- 1002. A+B for Polynomials (25)