url:http://www.cnblogs.com/hinimix/p/8016859.html

1, this list creation could be rewritten as a list literal
预先定义了一个list
list1 = [1,2,3,4] #这么用好

list1 = [1,2,3] #这么用不好
list1.append(4)
此时会出现该提示
解决链接:https://stackoverflow.com/questions/31063384/when-i-assign-a-list-to-variable-why-pycharm-give-me-a-prompt-that-is-this-list 2, unsupported operand type(s) for -: 'str' and 'int'
文件读出来的是字符串, 输入的是字符串,要注意强转类型 3, write() argument must be str, not None
写入文件的必须是字符串类型 4, TypeError: 'NoneType' object is not callable
写装饰器的时候,返回值的函数如果带()就会出这个错
def timer(func):
def test2():
start_time = time.time()
func()
end_time = time.time()
print("时间间隔是: --> %s " % (end_time - start_time) )
return test2()
正确应该这么写
def timer(func):
def test2():
start_time = time.time()
func()
end_time = time.time()
print("时间间隔是: --> %s " % (end_time - start_time) )
return test2
返回的是test2的内存地址, 然后去调用这个地址, 而不是直接直接test2() 5, auth() takes 0 positional arguments but 1 was given
装饰器时, 添加 6, dbm.error: db type could not be determined
d = shelve.open('shelve_test.txt'),文件名里的sheleve去掉 7, TypeError: a bytes-like object is required, not 'str'
with open('aoao.cnf', 'wb') as cfg:,打开文件不要用b,直接w 8, TypeError: key: expected bytes or bytearray, but got 'str'
加密时候应该用byte类型,而不是str 9, SyntaxError: bytes can only contain ASCII literal characters.
加密时候应该用ASCII类型,而不是汉字 10, TypeError: Level not an integer or a valid string: <function info at 0x7f9a4081f048>
level=logging.info是大写level=logging.INFO 11, _gdbm.error: [Errno 11] Resource temporarily unavailable
不知道 12, TypeError: string indices must be integer
类型不对,看看一堆dict里面是不是有str,会导致这样 13, ValueError: must have exactly one of create/read/write/append mode
文件打开模式有 r,w,a r+,w+,a+,我写的是rw,不对 14,TypeError: 'builtin_function_or_method' object is not iterable 15, a bytes-like object is required, not 'str'
传输进去的字符串需要是byte类型 16, TypeError: write() argument must be str, not bytes
pickle dump的文件是byte类型,所以打开文件不能用w,要用wb 17, TypeError: not all arguments converted during string formatting
print("set dog %s" % dog) 没写全, 少写了%s 18, TypeError: object() takes no parameters
__init__写成了__int__ 20, module 'urllib' has no attribute 'request'
因为python3.X有时候不会将子模块自动导入进去,所以改成import url.request问题就解决了 21, TypeError: exchange_declare() got an unexpected keyword argument 'type'
将type='fanout'变成exchange_type='fanout' 22, NameError: name 'uuid' is not defined
....from uuid import uuid4

最新文章

  1. 【Pyrosim案例】02:简单燃烧
  2. [工作中的设计模式]装饰模式decorator
  3. MSDeploy
  4. .NET实现高效过滤敏感查找树算法(分词算法):
  5. AccessRandomFile多线程下载文件
  6. HTML标签之间不是可以随便嵌套的
  7. MySQL索引原理与慢查询优化
  8. (转)C#与C++之间类型的对应
  9. UVA Graph Coloring
  10. 一个简单大方的赞后+1,踩后-1js动画效果
  11. 【转】jar包和war包的介绍和区别
  12. ::在c++中什么意思
  13. 接口-以PHP为例
  14. Spring基础系列-Web开发
  15. 【Teradata SQL】行转列函数TDStats.udfConcat
  16. flexbuilder 开发工具
  17. 阿里巴巴Java开发规约及插件安装
  18. python - 代码练习 - 备份目录/文件(windos环境)
  19. 装机uefi问题
  20. 百度富媒体展示允许自定义站点Logo/简介等

热门文章

  1. MySQL优化——MySQL 生产环境下 my.cnf 优化配置
  2. day 09作业 预科
  3. PHP Lumen Laravel 解决validate方法自定义message无效的问题
  4. python(练习题)
  5. 关于小程序授权地理位置(wx.getLocation + 用户体验)
  6. TOML配置文件
  7. 完美快速解决百度分享不支持HTTPS的问题
  8. Local CubeMap实现玻璃折射
  9. python的any()函数
  10. Optimal Marks SPOJ - OPTM(最小割)