04 2017 档案
摘要:报错“FileNotFoundError: [WinError 2] 系统找不到指定的文件”---win32 解决方法: 下载tesseract-ocr.exe安装,安装后将pytesseract.py(文件路径xxx\python34\Lib\site-packages\pytesseract\)
阅读全文
摘要:1.安装,直接easy_install PILLOW 2.导入,from PIL import Image
阅读全文
摘要:decode encode bytes >string >bytes decode('xxx'):将xxx转化成unicode encode('xxx'):将unicode转化成xxx 举例:百度,读取的文本乱码 con.text.encode('ISO-8859-1').decode('utf-8
阅读全文
摘要:1.安装tushare前先安装lxml和pandas(我是win32下python3.4.0) 2.安装lxml,下载地址https://pypi.python.org/pypi/lxml/3.4.2 3.pandas,下载地址https://pypi.python.org/pypi/pandas
阅读全文
摘要:打开文件后,需要关闭文件:f.close() 直接用语句with...as...就可以不用再添加close()方法: with open(path,'w') as f: f.write(content) with open(path,'r') as f: f.readlines()
阅读全文
摘要:import logging name=input() logging.basicConfig(filename=r'C:\Program Files\log.txt',datefmt='%Y-%m-%d %H:%M:%S %p',level=logging.DEBUG,format='%(asct
阅读全文
摘要:方法一:导入某一个模块 将模块(.py文件为一个模块)所在的目录加进来: import sys,os sys.path.append(path) import your_module 方法二:导入包下的所有模块 当前运行py文件下文件夹为package1 from package1 import *
阅读全文
摘要:1.当前目录: os.getcwd() 2.目录中包含内容: os.listdir(path) 3.是否为目录 os.path.isdir('E:\\book\\temp') 4.是否为文件 os.path.isfile('E:\\book\\temp') 5.把目录和文件名合成一个路径 os.pa
阅读全文