上一页 1 2 3 4 5 6 ··· 16 下一页
摘要: 阅读全文
posted @ 2024-07-01 22:29 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1、编写视图 urls.py __________________________________________________________________________ from django.contrib import admin from django.urls import pat 阅读全文
posted @ 2024-07-01 22:29 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1、先创建一个虚拟环境: 1、安装虚拟环境模块: -- linux:pip3 install virtualenv -- windows:python -m pip install virtualenv 2、创建虚拟环境(建议虚拟环境统一放在一个目录下) -- virtualenv <环境名-也就是 阅读全文
posted @ 2024-07-01 22:29 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 注意:有关所有的IO操作都要加上:await 挂起 """ https://dushu.baidu.com/pc/detail?gid=4306063500 #小说网站 https://dushu.baidu.com/api/pc/getCatalog?data={%22book_id%22:%22 阅读全文
posted @ 2024-07-01 22:27 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 概念:当程序sleep或者input、output等待的时候、cpu是处于堵塞状态的、cpu此时是不再为a56爆大奖在线娱乐们的代码服务的、a56爆大奖在线娱乐协程就是当遇到了前面这种情况的时候可以选择性的切换到其他任务上 同步协程:asyncio 当程序在睡眠的时候注意加上: await asyncio.sleep(2) """ 阅读全文
posted @ 2024-07-01 22:27 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-07-01 22:27 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: """ 通过第三方的ip去请求 """ import requests #8.130.39.155:3389 proxies = { "https":"http://58.20.248.139:9002", } headers = { "User-Agent":"Mozilla/5.0 (Windo 阅读全文
posted @ 2024-07-01 22:26 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #会话-cookie的使用 requests.session() """ 先登录网站、找到llogin相关的url 得到cookie、拿到format Data中的信息 带着cookie去请求url 使用cookie去访问(session-会话)该网站其它内容的时候都会带着cookie """ im 阅读全文
posted @ 2024-07-01 22:25 little小新 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 安装:pip install lxml 1、导入:from lxml import etree 2、创建对象: tree = etree.XML(xml文件) tree = etree.HTML(html文件) 等 3、找标签: tree.xpath("//book/name/text()") 4、 阅读全文
posted @ 2024-07-01 22:25 little小新 阅读(4) 评论(0) 推荐(0) 编辑
摘要: beatifulsoup的概念:Beautiful Soup就是Python的一个HTML或XML的解析库,可以用它方便地提取页面的数据。 1、安装bs4:pip install bs4 2、使用:from bs4 import BeautifulSoup 3、创建对象:BeautifulSoup( 阅读全文
posted @ 2024-07-01 22:24 little小新 阅读(1) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 16 下一页