上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页
摘要: 安装模块 pip3 install python-dotenv 使用方式 需要在根路径下新建 .env 文件,并写入配置 import os from dotenv import load_dotenv from dotenv import dotenv_values ### 方法一 res=loa 阅读全文
posted @ 2024-02-27 16:49 wellplayed 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 功能 当前目录下文件修改会被监控到,并打印日志 安装模块 pip3 install watchdog 运行方式 ——运行文件即可开启监控,自动监测文件变化 import sys import time import logging from watchdog.observers import Obs 阅读全文
posted @ 2024-02-27 15:57 wellplayed 阅读(12) 评论(0) 推荐(1) 编辑
摘要: 介绍 Click 是一个 Python 包,用于以可组合的方式使用尽可能少的代码创建漂亮的【命令行界面】。它是“命令行界面创建工具包”。它具有高度可配置性,但具有开箱即用的合理默认值 它的目的是使编写命令行工具的过程变得快速而有趣,同时也防止因无法实现预期的 CLI API 而造成的任何挫败感 Cl 阅读全文
posted @ 2024-02-27 15:52 wellplayed 阅读(6) 评论(0) 推荐(1) 编辑
摘要: 安装模块 pip intall flask 运行 from flask import Flask app = Flask(__name__) # 访问根路径打印字符串 @app.route('/') def index(): return 'hello world' if __name__ == ' 阅读全文
posted @ 2024-02-27 14:48 wellplayed 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 配置文件结构 #### 基础配置 # 项目名 BOT_NAME = "scrapy_demo" # 爬虫所在路径 SPIDER_MODULES = ["scrapy_demo.spiders"] NEWSPIDER_MODULE = "scrapy_demo.spiders" # 日志级别 LOG_ 阅读全文
posted @ 2024-02-23 16:20 wellplayed 阅读(10) 评论(0) 推荐(0) 编辑
摘要: scrapy目录结构 myfirstscrapy # 项目名字 -myfirstscrapy # 包 -__init__.py -spiders # 包 放爬虫,可能会有很多爬虫 -__init__.py -cnblogs.py # 爬虫文件--》一个爬虫就是一个文件,可以写多个 -items.py 阅读全文
posted @ 2024-02-23 16:04 wellplayed 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 校验密码 from django.contrib.auth.hashers import check_password # 需要导入User表 from django.contrib.auth.models import User # 实例化得到user对象 user = User.object.f 阅读全文
posted @ 2024-02-22 16:14 wellplayed 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 第一步:安装scrapy模块 pip install scrapy 第二步:在需要创建的文件夹内打开cmd窗口输入 scrapy startproject myfirstscrapy 会看到下面的命令: You can start your first spider with: cd myfirst 阅读全文
posted @ 2024-02-22 15:39 wellplayed 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 三种实现拖拽功能的方式 from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.support.wait import WebDriverWait # 等待页 阅读全文
posted @ 2024-02-22 15:09 wellplayed 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 语法格式如下 1 标签名 # 找xml中所有这个标签 2 / # 只找一层 3 // # 子子孙孙都会找 4 . # 从当前路径下 5 .. # 上一层 6 @属性名 # 找有这个属性的标签 数据准备 doc=''' <html> <head> <base href='http://example. 阅读全文
posted @ 2024-02-22 15:00 wellplayed 阅读(14) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页