![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
i学长的猫
这个作者很懒,什么都没留下…
展开
-
【Python】微博API
import requestsimport redef myfun(): data = [] regex =r"top\" target=\"_blank\">(.*)</a>" body = requests.get("https://s.weibo.com/top/summary") text = body.content.decode("utf-8") matches = re.finditer(regex, text, re.MUL.原创 2021-01-26 10:55:51 · 141 阅读 · 0 评论 -
抖音无水印
#!/usr/bin/env python3# -*- coding: UTF-8 -*-# https://github.com/missuo/douyinimport requestsimport reimport webbrowser# 输入链接,不用去除中文all_url = input("请输入需要解析的链接:(支持包含中文)")pattern = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\).原创 2020-12-18 17:32:25 · 286 阅读 · 2 评论 -
centos 后台启动python脚本,以及如何关闭
nohup python3 app.py >> start.log 2>&1 &原创 2020-11-25 16:21:46 · 629 阅读 · 0 评论 -
HP Tank410 打印机设置
1.2. 连接到3.https://192.168.223.1/#hId-pgWirelessSetup 设置向导,设置wifi账户密码即可原创 2020-11-20 11:49:58 · 6170 阅读 · 0 评论 -
【Python定时执行任务】
# coding=u8import time as _timeimport datetimefrom threading import Thread# 循环检查类class Timer(Thread): def __init__(self,timetable): super(Timer,self).__init__() self.tb = timetable self.delay = 1 #self.setDaemon.原创 2020-11-20 10:07:56 · 303 阅读 · 0 评论 -
Python 循环文件夹下的文件,找出正则匹配的内容 【以Lang.开头】
import jsonimport os# rootdir = 'E:\\WorkBench\\Code\\01C#-WLMS\\WLMS\\Views'# list = os.listdir(rootdir) #列出文件夹下所有的目录与文件# for i in range(0,len(list)):# path = os.path.join(rootdir,list[i])# if os.path.isfile(path):# #你想对文件的操作# pr.原创 2020-11-12 14:23:16 · 450 阅读 · 1 评论 -
python selenium 爬取俄罗斯 邮编对应的 街道地址
通过这两个网站http://index.kodifikant.ru/post/143396https://www.moscowindex.ru/rus/?s=143396工具 commondef printred(kw): print("\033[1;31m {}\033[0m".format(kw)) # print("\033[1;41m 字体颜色:浅灰色\033[0m") # print("\033[1;30m 字体颜色:白色\033[0m") .原创 2020-10-10 11:11:22 · 1952 阅读 · 2 评论 -
获取b站 浏览历史
1. import jsonimport requestsimport os def read_cookies_file(filename): with open(filename, 'r') as fp: cookies = fp.read() return cookiesdef get_header(filename): cookie = read_cookies_file(filename) headers = { ...原创 2020-09-24 15:21:20 · 809 阅读 · 0 评论 -
python print字体颜色 print背景颜色
https://blog.csdn.net/qq_34857250/article/details/79673698显示颜色的格式:\ 033 [显示方式;字体色;背景色m ...... [\ 033 [0m]显示颜色的参数:显示方式 效果 字体色 背景色 颜色描述0 终端默认设置 30 40 黑色1 高亮显示 31 41 红色4 使用下划线 32 42 绿色5 闪烁 33 ...原创 2020-07-20 17:49:09 · 1249 阅读 · 0 评论 -
【钉钉 获取所有用户的信息】【python】
from imp import reloadimport requestsimport json app_key='XX'app_secret='XX'agent_id='XX'corp_id='XX'def getAccess(): url = "https://oapi.dingtalk.com/gettoken?appkey={0}&appsecret...原创 2020-04-29 15:12:43 · 2517 阅读 · 0 评论 -
【python】连接oracle 报错
https://blog.csdn.net/jiaken/article/details/795376571.2.原创 2019-12-23 11:48:49 · 243 阅读 · 0 评论 -
【python】 根据域名得到 ip,并写入 HOST文件 (加快github速度) 需要管理员权限打开
# https://site.ip138.com/www.baidu.com'''使用说明: PATH :HOSTS文件路径 NEW_PATH :新HOSTS文件路径'''import sys, os, redef run(operType,ip,domin): PATH = r'C:\Windows\System32\drivers\etc\host...原创 2019-12-16 14:50:15 · 669 阅读 · 0 评论 -
【Python】 Scarpy 文件&图片下载(FilesPipeline和ImagesPipeline)
零、所用环境macOS 10.14.1Python 3.6.3scrapy 1.5.1一、文件下载(基于FilesPipeline)适用于下载包括但不限于PDF的各种文件。1、item.py(files未显性用到)item.py2、spider_name.py(yield url列表即可)spider_name.py3、pipelines.py...原创 2019-11-15 09:25:02 · 293 阅读 · 0 评论 -
【Python 】网易云音乐【3】
之前用到的是别人服务器的API接口: 现在自己搭建一个API平台:1. 下载NodeJS,并安装,配置好环境变量2. 下载 NodeJS源代码https://github.com/Binaryify/NeteaseCloudMusicApi3. 解压进入目录,并运行命令4. 成功!5.写一个脚本启动title 网易云音乐API服务cd D:\Pro...原创 2018-07-17 16:44:29 · 412 阅读 · 1 评论 -
Python基础
1. ifif你很持久:嫁给你elif 你很有钱:考虑一下else:滚蛋。2. 定义类class DuoLaAMeng: def __init__(self, name): self.name = name def getZhuQingTing(self): print("...原创 2019-04-09 09:56:05 · 171 阅读 · 0 评论 -
Python统计词蘋
# 导入扩展库import re # 正则表达式库import collections # 词频统计库import numpy as np # numpy数据处理库import jieba # 结巴分词import wordcloud # 词云展示库from PIL import Image # 图像处理库import matplotlib.pyplot as plt # 图...原创 2019-08-02 14:43:57 · 260 阅读 · 3 评论 -
合并多个excel,csv Excel+Python
合并多个csv'''Data:2017-07-13Auther;JXNU KerwinDescription:使用Pandas拼接多个CSV文件到一个文件(即合并)'''import pandas as pdimport osFolder_Path = r'C:\Users\wangjun\Desktop\py\1' #要拼接的文件夹及其完整路径,注意不要包含...原创 2019-08-15 17:23:48 · 2952 阅读 · 0 评论 -
python ❤
# print('\n'.join([''.join([('LiCuiFang'[(x-y) % len('LiCuiFang')] if ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 <= 0 else ' ') for x in range(-30, 30)]) for y in range(30, -30, -1)]))i...转载 2019-01-08 17:51:30 · 175 阅读 · 0 评论 -
Python抓取网易云 歌词,热评,热评用户的头像
in:key wordout:歌词,热评,热评用户的头像下载import requests import jsonimport osfrom urllib.request import urlretrieve def GetConment(kw): url = 'http://120.79.36.48/search?keywords=%20'+kw resp = requ...原创 2018-07-12 20:14:50 · 1060 阅读 · 1 评论 -
Python + Mysql 打造网易云音乐 热评库 + 评论头像下载【2】
热歌榜 热评http://music.163.com/#/discover/toplist 为动态网页,正常获取不到源码。我这里是通过保存为本地文件进行获取。import requests import jsonimport osfrom urllib.request import urlretrievefrom MySql import MysqlConnimpo...原创 2018-07-16 20:17:08 · 319 阅读 · 0 评论 -
Python 给图片加文字,加图片水印
1. 加文字from PIL import Image, ImageDraw, ImageFont # 指定要使用的字体和大小;/Library/Fonts/是macOS字体目录;Linux的字体目录是/usr/share/fonts/font = ImageFont.truetype('HW-AJun.ttf', 44,index=0) # image: 图片 text:要添加的...原创 2018-07-16 09:58:31 · 4978 阅读 · 1 评论 -
【Windows定时执行py文件】
打开 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\ 文件夹下面的 创建任务:原创 2018-08-22 08:18:58 · 555 阅读 · 0 评论 -
Python 抓取旅游信息
1. 抓取全国景点 【网站 http://www.bytravel.cn 数据】#coding=UTF-8 from urllib.request import Request, urlopen,quotefrom urllib.error import URLErrorimport chardetfrom bs4 import BeautifulSoup as BSim...原创 2018-10-25 14:19:05 · 1540 阅读 · 0 评论 -
Python 安装sublimeREPL 插件并设置快捷键
https://github.com/HBLong/channel_v3_daily换源安装插件sublimeREPL然后tool--sublimeREPL--Python--run current file每次都点太麻烦了,可以自己设置下快捷键,在key bindigs[ { "keys": ["f5"],//这是自己设的快捷键 ...原创 2018-12-12 14:26:20 · 784 阅读 · 0 评论