1. 多行字符串可以通过三个连续的单引号 (”’) 或是双引号 (“”") 来进行标示 >>> a='''a bc def ''' >>> print a a bc def 2. 矩阵初始化 C = [[0 for col in range(1682)] for row in range(1682)] 或者用循环的方式: # above uses the same tmp list, will cause matrix value to change when…
今天编译pyhon做人脸识别,遇到几个问题,做个记录吧. 编译报错: File "harrClassifier.py", line 17, in <module> flags=cv2.CV_HAAR_SCALE_IMAGEAttributeError: 'module' object has no attribute 'CV_HAAR_SCALE_IMAGE' 定位根本原因还是不同库文件更新导致的,具体的问题要改成什么,就要 查一下了. 网上查的资料显示,修改后的确能解决问…
1.tab缩进2.读取文件,在文件名前加r或者R.这是因为python原始字符串特性,即在字符串的前面已R或者小写字母r开始,则字符串不对\进行转移,直接输出,通常用于表示windows的路径.file = open(r'E:\soft\Python\script\a.txt')for line in file.readlines(): print linefile.close()…