Python
YDDUONG
这个作者很懒,什么都没留下…
展开
-
Numpy Pandas Matplotlib 快速上手
【莫烦Python】Nnmpy & Pandas: https://www.bilibili.com/video/BV1Ex411L7oT【莫烦Python】Matplotlib Python 画图教程: https://www.bilibili.com/video/BV1Jx411L7LUNumpy 官网文档:https://www.numpy.org.cn/user/setting-up.htmlPandas 官网文档:https://www.pypandas.cn/docs/Matp.原创 2021-12-13 19:44:30 · 2296 阅读 · 0 评论 -
conda 换源及常用命令
换源:-------------------------------------------------------------------------------在cmd终端,分别输入如下三行命令:conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anac原创 2021-06-03 17:29:15 · 7012 阅读 · 0 评论 -
Python 处理读取ini文件,生成代码
读写文件:# writewith open(-file, 'w', encoding='utf-8') as f: f.write('test')# readwith open(_file, 'r', encoding='utf-8') as f: lines = f.readlines()文件是否存在:if not os.path.exists(_file): print(f'{_file} is not exist')拆分文件路径和文件名:f..原创 2021-06-03 17:23:05 · 279 阅读 · 0 评论 -
anaconda :ValueError: check_hostname requires server_hostname
使用了VPN,没有添加代理,导致的如果你配置过国内镜像,在C盘用户文件下,有个隐藏文件(当用户第一次运行 conda config 命令时,将会在用户的家目录创建该文件):.condarc打开这个文件,添加:proxy_servers: {http: 127.0.0.1:10080, https: 127.0.0.1:10080} 10080是VPN代理的端口整体情况如下:channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs原创 2021-06-03 14:26:02 · 3614 阅读 · 3 评论 -
Python 合并多个PDF
主要使用的第三库为:PyPDF2 操作PDF pip install PyPDF2natsort 对文件进行自然排序 pip install natsort参考:https://www.jianshu.com/p/6eb4f269adc1PyPDF2 编码问题’latin-1’:https://blog.csdn.net/weixin_43116153/article/details/105218309代码如下:# -*- coding:utf-8*-import osimport原创 2021-01-01 17:18:26 · 258 阅读 · 1 评论 -
python操作word文件,替换文本保留原格式
这里的替换文本保留原格式是指,替换word中有规律的字符串,比如将6-7…6-28全部加一,替换成6-8…6-29#coding: utf-8import os, sys# 安装docx: pip install python_docxfrom docx import Documentfrom docx.shared import Inchesfile_name = os.path.join(sys.path[0], "bylw.docx")print(f'file name: {file_原创 2020-05-13 10:48:55 · 7624 阅读 · 5 评论 -
python多线程爬虫实例
单线程爬虫已经写过了,这边文章就对上一篇爬虫进行该着,改成多线程的,上期文章:https://blog.csdn.net,对比单线程,相同的任务量多线程可以从107秒降到8秒左右(主要指获取图片链接并写到文件中)对于多线程爬虫,常见有2种写法,一种是继承threading.Thread类,还有一种是直接使用,至于线程池什么的,我还没了解过,本篇文章是直接使用Thread。一般来说:CPU密...原创 2020-02-22 00:28:31 · 1055 阅读 · 0 评论 -
使用xpath爬取壁纸图片
这是一个爬取壁纸的爬虫,网址:http://www.win4000.com/wallpaper_205_0_10_1.html爬取过程:1.打开网址,是套图,所以先收集套图的跳转链接,以套图的名称创建一个TXT文本2.通过跳转链接,收集每套图的图片链接,并写道对应的TXT文本中3.遍历文件夹下所有TXT文件,下载里面的图片,每套图分别保存到不同的文件下涉及技术:自定义本机head...原创 2020-02-20 14:21:43 · 1122 阅读 · 0 评论