随笔分类 -  Python

摘要:import urllib3 from selenium import webdriver from bs4 import BeautifulSoup import os import requests from urllib.parse import urljoin, urlparse impor 阅读全文
posted @ 2024-08-16 14:36 _迷途 阅读(22) 评论(0) 推荐(0) 编辑
摘要:代码 # coding:utf-8 import http.server import json import psutil import socket import platform import multiprocessing import os # 获取网络接口信息 def get_netwo 阅读全文
posted @ 2024-02-22 00:24 _迷途 阅读(224) 评论(0) 推荐(0) 编辑
摘要:先下载依赖 pip3 install psutil 代码 import psutil # 获取 CPU 温度 def get_cpu_temperature(): try: temperatures = psutil.sensors_temperatures() if 'coretemp' in t 阅读全文
posted @ 2024-02-08 23:27 _迷途 阅读(1760) 评论(0) 推荐(0) 编辑
摘要:import asyncio import datetime import time import aiohttp from aiohttp.client_exceptions import ClientConnectorError # 替换链接地址list urls = [ ] async def 阅读全文
posted @ 2023-04-17 16:44 _迷途 阅读(209) 评论(0) 推荐(0) 编辑
摘要:pip install Pillow import hashlib from io import BytesIO def get_hash(file): """ :param bytes file: :return: """ md5hash = hashlib.md5(Image.open(file 阅读全文
posted @ 2023-01-10 15:04 _迷途 阅读(328) 评论(0) 推荐(0) 编辑
摘要:企业微信群机器人说明文档:https://developer.work.weixin.qq.com/document/path/91770。利用群机器人有个优点,在程序哪里经常抛出异常,就可以在第一时间知道。 Python3: import json import requests from dat 阅读全文
posted @ 2022-12-14 09:30 _迷途 阅读(307) 评论(0) 推荐(0) 编辑
摘要:import json import os, sys import platform import time from seleniumwire import webdriver from selenium.webdriver.firefox.firefox_binary import Firefo 阅读全文
posted @ 2022-07-28 17:19 _迷途 阅读(425) 评论(0) 推荐(0) 编辑
摘要:db_host = "localhost" db_user = "root" db_pass = "root" db_name = "test" db_port = 3306 db_charset = "utf8" # -*- coding: utf-8 -*- """Python连接到 MySQL 阅读全文
posted @ 2022-03-17 09:47 _迷途 阅读(349) 评论(0) 推荐(0) 编辑
摘要:def is_between(start_at, end_at) -> bool: """ 判断当前时间是否在指定时间之间 例如:指定时间段为[09:00:00, 18:00:00]若当前时间是 2021年8月16日17:53:45 ,判断是否在这个时间段,返回 True 另外:若指定时间段为[22 阅读全文
posted @ 2021-08-16 18:28 _迷途 阅读(1029) 评论(0) 推荐(0) 编辑
摘要:Python string强转int def to_int(my_str) -> (int, bool): try: int(my_str) return int(my_str) except ValueError: # 报类型错误,说明不是整型的 try: float(my_str) # 用这个来 阅读全文
posted @ 2021-08-16 17:20 _迷途 阅读(395) 评论(0) 推荐(0) 编辑
摘要:由于公司项目需要获取谷歌搜索结果。可是谷歌搜索出来的结果大多都不足20页。直接上代码 import time from pprint import pprint import requests from bs4 import BeautifulSoup class GoogleSpider: def 阅读全文
posted @ 2021-07-13 15:11 _迷途 阅读(369) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示