![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
aliyunfw
这个作者很懒,什么都没留下…
展开
-
Flask uwsgi与nginx部署(详细配置)
环境python2或3都支持linuxUWSGI 下载pip install uwsgiUWSGI 配置[uwsgi]# 外部访问地址,可以指定多种协议,现在用http便于调试,之后用socket# socket方式socket=0.0.0.0:7777# http方式http=0.0.0.0:7777# http与socket通用方式http-socket=0.0.0.0:7777# 项目路径# chdir=/home/ubuntu/aptpythonpath=/ho原创 2022-01-28 18:00:56 · 3703 阅读 · 1 评论 -
python自动化,整理一下openpyxl,xlrd和xlwt的常用方法
openpyxlopenpyxl常用来处理xlsx文件加载excel文件选择sheetimport openpyxlwb = openpyxl.load_workbook(file_path) # 加载已经存在的excel表格ws = wb.active # 选择默认的sheetws = wb.worksheets[index] # 通过索引选择sheet,index从0开始all_sheet_name = wb.get_sheet_names() # 获取表格所有sheet名称原创 2020-09-14 14:51:09 · 429 阅读 · 0 评论 -
Python 利用pytesseract识别简单的验证码图片
环境准备Tesseract-OCR(百度自行下载合适的版本,下载成功后将文件夹添加到环境变量中)pillow模块(pip install pillow)pytesseract模块(pip install pytesseract)代码实现import pytesseractfrom PIL import Imagedef image_to_str(image_path): # 使用路径导入图片 im = Image.open(image_path) # 转化到..原创 2020-07-14 16:31:43 · 564 阅读 · 1 评论 -
Python 使用openpyxl读取excel字体颜色与单元格颜色
环境准备python3openpyxl代码 wb = openpyxl.load_workbook(filedir) sheet = wb.active sheet.cell(row, col).font.color.rgb # 获取 表格内字体颜色 sheet.cell(row, col).fill.fgColor.rgb # 获取表格 填充色 颜色注意事项只能读取标准色...原创 2020-05-11 14:41:17 · 17706 阅读 · 11 评论 -
scrapy中同一个爬虫设置多个item时pipelines怎么管理数据
https://blog.csdn.net/sinat_32651363/article/details/79092431转载 2020-04-16 11:30:53 · 1225 阅读 · 0 评论 -
解决因为网络问题使用pip下载包失败的问题
最近下载selenium包时总是报错pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.,在网上查找了一下是因为网络问题导致下载失败。下载失败的代码pip install selenium...原创 2020-03-11 18:27:30 · 687 阅读 · 0 评论 -
解决因为移动python环境位置导致pip路径不对的问题
前言电脑的python环境配置与pip install 下载包的位置不同,具体原因是因为之前手动移动过python环境的位置。解决方法在pip install 前加入 python -m 就可以达到一样的效果python -m pip install 包名...原创 2020-01-10 10:20:32 · 7144 阅读 · 3 评论 -
python读取excel中的图片
环境准备:python3pillowpip install pillowpypiwin32pip install pypiwin32代码from PIL import ImageGrabimport win32com.client as win32excel = win32.gencache.Ensure原创 2020-01-08 08:51:36 · 4591 阅读 · 9 评论 -
python实现将一个目录下的所有doc文件转为docx格式文件
from win32com import client as wcfrom docx import Documentimport shutildef file_clear(dir_path): """文件清理,将doc文件转为docx文件""" if not os.path.isdir(dir_path + 'docx): os.mkdir(dir_path + 'docx') a...原创 2019-10-15 11:36:48 · 1927 阅读 · 0 评论 -
python并行计算ipyparallel的基本使用
安装ipyparallel从4.0开始,IPython parallel现在是名为的独立程序包ipyparallel。您可以使用以下方法安装它:pip install ipyparallel或者:conda install ipyparallel入门要将IPython用于并行计算,您需要启动一个控制器实例和一个或多个引擎实例。最初,最好使用ipcluster命令在单个主机上启动控制...原创 2019-10-11 17:10:06 · 5457 阅读 · 2 评论 -
如何在manage之外运行django代码
def init_django(setting_file): base_path = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(base_path)) os.environ.setdefault("DJANGO_SETTINGS_MODULE", setting_file) djan...原创 2019-09-30 15:38:38 · 116 阅读 · 0 评论 -
Python2解压rar文件
在winrar软件中找到UnRAR.exe放入您的项目环境中的Scripts文件夹下如果你的程序需要在32位系统和64为系统中运行,请下载32位的UnRAR.exepip install rarfile编写代码r = rarfile.RarFile(文件绝对路径, 'r') # 创建rar文件对象r.extractall(path=解压路径) # 解压文件r.close()...原创 2019-04-17 14:50:29 · 745 阅读 · 0 评论 -
Python单元测试
继承unittest.TestCase import unittest class JustForTest(unittest.TestCase): def runTest(self): length = 10 self.assertEqual(10, length...原创 2018-12-06 11:37:53 · 118 阅读 · 0 评论