
python
s听风忆雪
best QQ2276259727
展开
-
python获取文当前文件文件名称
此代码运行后不包含文件后缀import repath = __file__file_name = re.findall(r'[\.\\]?(\w+)\.py$', path)# str = u''print(file_name)exit()['fileName']原创 2020-09-19 14:18:06 · 578 阅读 · 0 评论 -
每日一词
import requests, osfrom lxml import etreehtml = requests.get('https://tool.lu/timestamp/')text = etree.HTML(html.text)reg = '//*[@class="note-container"]/text()'content = text.xpath(reg)[0]result = content.strip()os.system('cls')# os.system('ec.原创 2020-06-15 14:25:40 · 157 阅读 · 0 评论 -
Python实现软件自动登录&超时锁屏
就这个东西总是掉线 ↓*如果脚本需要点击 再执行脚本期间不要锁屏 锁屏后点击事件失效# 用于 vpn 退出时 自动点击# 点击屏幕指定像素点# 左上角 x 837 y 604# 右下角 x 1101 y 637import pyautogui, time, sysfrom ctypes import *# 换成具体图片searchFile = './im...原创 2020-06-01 11:49:53 · 499 阅读 · 0 评论 -
竟然有人用python做这种事 ۦُ۟۟ۖۖۖٛۥۗۙۙۗۡۥٌۚۚۗۛۥۛۚۛۡۥۖۛۛۦُُ۟۟ۖۖۖٛ۟ۗۖۚۥٌُٞۖۛۚ۟ۥٌٌۖۖ۟ۖۦٌ (Python 实现挂机自动锁屏)
# 基于windows系统 实现思路是检测鼠标坐标超过多久未移动调用系统锁屏# 加载所需模块import pyautogui,timefrom ctypes import *# 用于计数t = 0# 第一次点击时的坐标first_x = 0first_y = 0# 挂机多久秒后锁屏time_out = 120 try: # 一直执行 while Tr...原创 2019-12-17 10:33:19 · 3707 阅读 · 0 评论 -
python实现将图片添加水印并设置为桌面背景
代码可以直接使用的(所需的包都存在的情况下 python v 3.6+ )注意代码中的路径信息# 给图片添加水印并设置为桌面壁纸import PILimport timeimport osimport ctypesfrom PIL import Imagefrom PIL import ImageDrawfrom PIL import ImageFontdef ba...原创 2019-09-03 11:16:29 · 846 阅读 · 0 评论 -
Fatal error in launcher: Unable to create process using '""d:\program files (x86 )\python\python.exe
当使用pip安装扩展是报Fatal error in launcher: Unable to create process using '""d:\program files (x86)\python\python.exe" "D:\Program Files (x86)\python\Scripts\pip.exe" '解决方法有 1: python -m pip i...原创 2018-12-02 09:19:15 · 6207 阅读 · 0 评论 -
python 3.7安装win32
访问这个链接 https://github.com/mhammond/pywin32/ 下翻 找到 点击下载后 下一步安装就行 安装完成之后 import win32没有问题说明安装成功原创 2018-11-24 19:07:27 · 3116 阅读 · 3 评论 -
pip 报 Fatal error in launcher: Unable to create process using 肯定好使
当使用pip安装扩展是报Fatal error in launcher: Unable to create process using '""d:\program files (x86)\python\python.exe" "D:\Program Files (x86)\python\Scripts\pip.exe" '解决方法有 1: python -m pip install -...原创 2018-04-18 18:29:01 · 393 阅读 · 0 评论 -
python 解决ip自动获取 虚拟域名访问不到
# 开机自动更改ip hosts 和 httpd-vhtosts 两个文件import osimport socketimport codecsimport re# 加入开机启动 %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup path=r'C:\Windows\System32\drivers\etc\hosts'...原创 2018-04-13 09:48:51 · 609 阅读 · 0 评论 -
解决python with 在写入文件是因编码格式不同而造成乱码问题
解决with操作问价乱码问题读取的时候可以设置字符串格式 decode('utf-8')读取文件写入的时候可以设置成 str.encode('utf-8')如果不行可以设置一下 with的第三个参数 encoding='utf-8'例如: with open(r'D:\path\2019.txt','w',encoding='utf-8') as file: #这就设置成了utf-8格式字符...原创 2018-04-12 10:48:49 · 2223 阅读 · 0 评论