各种 错误

1.

print(int(bool))    #int()里只能为字符串,数字,len()

TypeError: int() argument must be a string, a bytes-like object or a number, not 'type'

可以print(str(bool))    <class 'bool'>

2.

print(set/dict/tuple(bool))
TypeError: 'type' object is not iterable

bool(int//str/list/dic/set)空则为Flase有则为True

注:tuple()为元组  tuple(1)为int

3.str[]

SyntaxError: invalid syntax

语法错误[ ]中不能为空(可以为下标,范围,正切加步长,反切加步长)

a='asdasd'[-1:-5]   print()后会取不出东西应该为a='asdasd'[-5:-1] 

4.print(md5(int/list...))      只能用字符串

AttributeError: 'int' object has no attribute 'encode'

5.

注 文件名一定不能是 import 引入库的名字

import cv2
File "D:F盘课程视频day03day3cv2.py", line 2, in <module>
scr=cv2.imread('D:picturescenery.jpg')
AttributeError: module 'cv2' has no attribute 'imread'

 6.OPENCV cv2图像处理高和宽的位置。

Python中Numpy数组所表示的图像
Python中使用Numpy 数组代表的图像时,表示的是一个二维数组。用shape方法得到的数组属性为(height,width,depth)。当我们第一次用Numpy数组处理图像的时候,常常感到疑惑的是:为什么height会在width前面了?

这个是因为矩阵的定义。二维数组我们一般也可以用矩阵表示。当我们定义一个矩阵大小时,我们常常说是多少行多少列的矩阵。矩阵中的行在图像坐标系中恰好对应的是图像的高度,而矩阵中的列恰好对应图像的宽度,而图像的深度的depth未改变其含义。

原文地址:https://www.cnblogs.com/qj696/p/10608985.html