随笔分类 -  python全栈

摘要:base64 import base64 def main(): s = "haha123" bs = base64.b64encode(s.encode('utf-8')) print(bs) //b'aGFoYTEyMw==' print(bs.decode('utf-8')) # aGFoYT 阅读全文
posted @ 2022-04-22 12:03 icui4cu 阅读(155) 评论(0) 推荐(0) 编辑
摘要:ICMP scapy基本操作 前期准备 在Linux中使用pycharm进行接下来的操作,以便帮我们实现网络底层功能 去pycharm官网下载pycharm的Linux版本 https://www.jetbrains.com/pycharm/download/#section=linux 将pych 阅读全文
posted @ 2022-04-21 21:23 icui4cu 阅读(223) 评论(0) 推荐(0) 编辑
摘要:表单处理 main.py @app.route('/chuli', methods=['POST']) def chuli(): if request.method == 'POST': # uname和passwd是前端的name字段里的字符 username = request.form.get 阅读全文
posted @ 2022-04-18 16:05 icui4cu 阅读(33) 评论(0) 推荐(0) 编辑
摘要:支持html返回 @app.route('/a') def a_page(): return Response('<h1>haha nihao</h1>' '<br><hr>' '<h2>ddddd</h2>', 200) 模板使用 调用模板 在templates文件下新建一个HTML 5 file 阅读全文
posted @ 2022-04-17 21:54 icui4cu 阅读(100) 评论(0) 推荐(0) 编辑
摘要:前置设置 在settings中的Manage Repositories修改python源为douban:https://pypi.douban.com/simple/ ,并下载flask包 flask基本设置 **flask:**python轻量级web框架,自己本身就是一个中间件,借助操作系统安装 阅读全文
posted @ 2022-04-17 16:12 icui4cu 阅读(37) 评论(0) 推荐(0) 编辑
摘要:03.图像处理 在setting中设置导入pillow库 前置知识 **RGB颜色:**3个颜色通道组成的颜色 **3个颜色:**红(255,0,0)、绿(0,255,0)、蓝(0,0,255) **其他常见:**黄(255,255,0) 一个像素(pixel)=3字节 做实验的两张图如下,分别为k 阅读全文
posted @ 2022-04-16 19:00 icui4cu 阅读(69) 评论(0) 推荐(0) 编辑
摘要:和python进行互动 安装redis库 pip3 install redis 连接数据库 import redis # StrictRedis和Redis效果一样,后者是前者的子集 r = redis.StrictRedis(host='localhost',port=6379,db=0) r.s 阅读全文
posted @ 2022-04-16 18:55 icui4cu 阅读(75) 评论(0) 推荐(0) 编辑
摘要:Redis 介绍 NoSQL类型数据库之一,内存运行,效率极高,支持分布式,理论上可以无限拓展数据库,支持各种语言的API,可安装在各种平台 关系型数据库:MySQL、SQLServer、Oracle 非关系型数据库:NoSQL、Redis(key-value) 特点: c/s通信模式(Client 阅读全文
posted @ 2022-04-16 18:54 icui4cu 阅读(33) 评论(0) 推荐(0) 编辑
摘要:同时采集多个字段 items.py import scrapy class Test1Item(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() # 在items定义数据类型 titl 阅读全文
posted @ 2022-04-16 18:53 icui4cu 阅读(33) 评论(0) 推荐(0) 编辑
摘要:模拟手机操作 # 引入触控类 from selenium.webdriver.common.touch_actions import TouchActions mobileEmulation = {'deviceName':'iPhone 6/7/8'} options = webdriver.Ch 阅读全文
posted @ 2022-04-16 18:52 icui4cu 阅读(38) 评论(0) 推荐(0) 编辑
摘要:cookie操作 # 查看cookie cookie = driver.get_cookies() print(cookie) # 增加cookie driver.add_cookie({'name':'xiaoming','key':'9988'}) # 清除所有cookie driver.del 阅读全文
posted @ 2022-04-16 18:51 icui4cu 阅读(54) 评论(0) 推荐(0) 编辑
摘要:拖拽操作 # 拖拽操作 first_target = driver.find_element_by_xpath("//span[contains(text(),'喜羊羊与灰太狼之决战次时代')]") second_target = driver.find_element_by_xpath("//a[ 阅读全文
posted @ 2022-04-16 18:50 icui4cu 阅读(35) 评论(0) 推荐(0) 编辑
摘要:selenium电脑模式和手机模式 # 指定调用某个地方的chrome options = webdriver.ChromeOptions() # chrome浏览器的主程序位置 location = r"F:\All_python_code\scrapy\chrome-win\chrome.exe 阅读全文
posted @ 2022-04-16 18:49 icui4cu 阅读(41) 评论(0) 推荐(0) 编辑
摘要:xpath 处理网页:pip install lxml from lxml import etree # 网页的源码 html_doc = resp.content.decode('utf-8') # 使用etree去转换html_doc,转换成了一个html对象,此时element对象可以使用xp 阅读全文
posted @ 2022-04-16 18:48 icui4cu 阅读(40) 评论(0) 推荐(0) 编辑
摘要:Json 在线数据生成器:https://www.onlinedatagenerator.com/ 加载json数据 import requests import json # from pprint import pprint def main(): url = "http://192.168.2 阅读全文
posted @ 2022-04-16 18:47 icui4cu 阅读(119) 评论(0) 推荐(0) 编辑
摘要:爬虫实验 简单的爬取网页源代码 import requests def main(): url = "http://www.4399dmw.com/search/dh-1-0-0-0-0-{}-0/" url_list = [] headers = { "User-Agent": "User-Age 阅读全文
posted @ 2022-04-16 18:44 icui4cu 阅读(203) 评论(0) 推荐(0) 编辑

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