随笔分类 - python
python学习
摘要:def list_all_dict(dict_a): if isinstance(dict_a,dict) : #使用isinstance检测数据类型 for x in range(len(dict_a)): temp_key = list(dict_a.keys())[x] temp_value
阅读全文
摘要:运行时提示: requests.exceptions.InvalidHeader: Invalid return character or leading space in header: user-agent 主要原因是headers中的值开头不能是空格 正确:'user-agent': 'Moz
阅读全文
摘要:import time def get_second(): """ :return: 获取精确到秒时间戳,10位 """ return int(time.time()) def get_millisecond(): """ :return: 获取精确毫秒时间戳,13位 """ millis = in
阅读全文
摘要:https://h5api.m.goofish.com/h5/mtop.taobao.idle.mach.advertise.batch.output/1.0/?jsv=2.6.1&appKey=12574478&t=1645101246629&sign=ad4ebcdb386e847155f72f
阅读全文
摘要:#!/usr/bin/env python # -*- coding: utf-8 -*- #文件内容修改后其对应的MD5值也改变,从而可以利用MD5值判断文件是否被修改过 import sys import hashlib import hashlib def get_file_md5(file_
阅读全文
摘要:列出从数字1,2,3,4中任取3个数的所有排列与组合 实现import itertools # 排列(有序)my_list = list(itertools.permutations([1, 2, 3, 4], 3))print(my_list)# 组合(无序)my_list = list(iter
阅读全文
摘要:from hashlib import md5 from string import ascii_letters,digits from itertools import permutations from time import time import pymysql,sys all_letter
阅读全文
摘要:连接ADB设备: 可以通过USB或Wifi与ADB设备进行连接,进而调用Uiautomator2框架,支持同时连接单个或多个ADB设备。 USB连接:只有一个设备也可以省略参数,多个设备则需要序列号来区分 import uiautomator2 as u2 d = u2.connect("--ser
阅读全文
摘要:ftplibpexpect telnetlib https://github.com/camelot-dev/camelot 处理提取pdf 解决安装问题https://camelot-py.readthedocs.io/en/master/user/install-deps.html ffmpy安
阅读全文
摘要:import ctypes from ctypes.wintypes import * import win32clipboard from win32con import * import sys class BITMAPFILEHEADER(ctypes.Structure): _pack_ =
阅读全文
摘要:替换字符串中?后面所有的字符 >>> ab="asfasfasfasdf?asfasdfasfasd" >>> ac=ab.split("?",1)[0] >>> ac 'asfasfasfasdf' >>> https://mp.weixin.qq.com/s/W-lc8T9ZSh-GOYRoZo
阅读全文
摘要:pid = GetWeChatPID('WeChat.exe')app = Application(backend='uia').connect(process=pid)# 拿到微信主窗口win_main_Dialog = app.window(class_name='WeChatMainWndFo
阅读全文
摘要:python3安装win32api先安装pip install pywin32再安装python -m pip install pypiwin32
阅读全文
摘要:import time,sys import psutil from pywinauto.application import Application from time import sleep from pywinauto import mouse from pywinauto.keyboard
阅读全文
摘要:pyinstaller -F -w -i aa.ico u-pan2.py 打包 并不打开黑屏窗口,aa.ico为图标文件
阅读全文
摘要:setting.py CLOSESPIDER_TIMEOUT=25200(七小时后关闭爬虫)
阅读全文
摘要:setting.py加入 COOKIES_ENABLED = False 设置 DEFAULT_REQUEST_HEADERS = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML,
阅读全文
摘要:import schedule def job(name): print("her name is : ", name) name = "longsongpong" schedule.every(10).minutes.do(job, name) #每隔十分钟执行一次任务 schedule.ever
阅读全文
摘要:Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Python.File\shell\EditwithIDLE] @="&Edit with IDLE" [HKEY_CLASSES_ROOT\Python.File\shell\Editw
阅读全文
摘要:small=[chr(i) for i in range(97,123)]#小写字母 small=[chr(i) for i in range(65,91)]#大写字母 import time tt=time.time() tta=int(tt) print(tta) localTime = tim
阅读全文