自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 资源 (1)
  • 问答 (2)
  • 收藏
  • 关注

原创 pygame简单实现游戏开始菜单

pygame简单实现菜单。

2023-10-10 18:13:03 664

原创 【python 】pygame制作简单的游戏移动操作

pygame简单游戏实现

2022-09-01 22:11:44 2601 1

原创 解密rar、pdf、word

需要2个工具Hashcat +john the ripperhashcatjohn the ripper下载解压得到获取需要解密文件的hash…\john-1.9.0-jumbo-1-win64\run下的工具使用相对应的命令//Wordpython office2john.py test.docx//Pdfperl pdf2john.pl test.pdf //zipzip2john.exe test.zip//rarrar2join.exe test.rar运行

2022-01-05 22:49:34 1630

原创 python操作windows注册表

官方文档添加链接描述

2021-08-10 11:08:06 489

原创 Python开发植物大战僵尸

合集:https://space.bilibili.com/234979113/channel/detail?cid=1202801.绘制场景https://www.bilibili.com/video/BV1be411x7u92.豌豆射手登场https://www.bilibili.com/video/BV1WZ4y1j7kh3.太阳花、坚果出场https://www.bilibili.com/video/BV1ai4y1b7ZF4.增加卡槽https://www.bilibili.co.

2021-03-30 22:44:01 679

原创 drf入门实例操作序列化【1】

1.环境配置安装1.1创建虚拟环境创建虚拟环境目录virtualenv -p python drfdemo进入虚拟生产环境:source drfdemo/bin/activate1.2安装需要的依赖查看当前环境下的库pip list安装django,djangorestframeworkpip install django -i https://pypi.tuna.tsinghua.edu.cn/simple/pip install

2020-05-26 04:19:07 305

原创 python获取qq音乐,命令下实现搜索,试听功能

效果实现代码:1.搜索api有时效性2.解析MP3地址同样道理如失效,自行修改相应的api,如有更好的api或者方法,希望分享和谈论方法!# -*- coding: utf-8 -*-import requests# from fake_useragent import UserAgentimport jsonimport osfrom prettytable import PrettyTableclass Music: limit = 10 # h

2020-05-25 19:59:31 596

原创 落单的数,

def singleNumber(A): EOR = 0 for item in A: EOR = EOR ^ item #一次遍历 # s = set(A) # for x in s: # if A.count(x)==1: # print(x) #多次遍历 # s={} # for x in A: # if x in s.keys(): # .

2020-05-25 07:31:39 143

原创 读txt写入excel简单操作

import xlwtdef read_txt(): with open('tiku.txt', 'r')as f: for line in f.readlines(): line = line.strip('\n') print(line)def wirte_excel(): # 创建工作簿 设置编码 file = xlwt.Workbook(encoding='utf-8') # 创建一个worksh...

2020-05-23 20:53:58 478

原创 ubuntu下安装mysql

安装mysqlsudo apt-get install mysql-server mysql-client查看账密sudo cat /etc/mysql/debian.cnf登陆(用查到的账号密码)mysql -u debian-sys-maint -p修改ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';...

2020-05-10 16:27:53 103

原创 Strak组件,关键字搜索

1.stark.pyfrom django.db.models import Qclass StarkAdmin(object): search_list=[] def get_search_list(self): val=[] val.extend(self.search_list) return val de...

2020-04-28 12:31:15 236

原创 Stark组件-批量操作实现

1.stark.pyclass StarkAdmin(object): def multi_delete(self,request): print('all delete') pk_list=request.POST.getlist('pk') self.model_class.objects.filter(pk__in=pk_...

2020-04-28 10:22:00 385

原创 Stark组件各种自定义功能~~

1获取列表的数据2.排序3.自定义字段class StarkAdmin(object): #排序 order_by = [] #显示列表字段 list_display=[] def __init__(self, model_class, site): self.model_class = model_class ...

2020-04-28 06:47:34 331

原创 django2 stark组件简单实现根据model创建url

1.创建app(stark)apps.pyfrom django.apps import AppConfigfrom django.utils.module_loading import autodiscover_modulesclass StarkConfig(AppConfig): name = 'stark' def ready(self): ...

2020-04-24 00:46:22 175

原创 WIN10下wsl的ubuntu创建django项目开发简单操作

#创建工程文件mkdir my_project#进入目录cd my_project#创建虚拟环境python -m venv myvenv#进入虚拟环境source myvenv/bin/activate#安装djangopip install django#列出安装包导出到文件pip freeze >requirements.txt#django创建项目djang...

2020-04-23 02:03:32 875

原创 django2 简单实现根据model创建url

1.创建models.pyfrom django.db import modelsclass Article(models.Model): title=models.CharField(max_length=32)2.urls.pyfrom django.contrib import adminfrom django.urls import path,includ...

2020-04-21 22:16:03 253

原创 原生form简单实现CURD

1.pycharm创建django项目2.app下models.pyfrom django.db import modelsclass Book(models.Model): title = models.CharField(max_length=32) price = models.DecimalField(max_digits=8, decimal_places...

2020-04-20 19:08:21 213

原创 Django权限管理rbac基于中间件校验简单实现

1.pycharm创建django项目2.app下models.pyfrom django.db import models#用户class User(models.Model): name = models.CharField(max_length=32) pwd = models.CharField(max_length=32) roles = mode...

2020-04-18 23:43:09 407

原创 【Python做游戏】植物大战僵尸-9地图区域划分

利用pygame模块开发项目迭代开发~github地址:https://github.com/leemamas/pvz演示视频地址:https://www.bilibili.com/video/BV1Dz411b7D3/https://www.bilibili.com/video/BV1mC4y1s7hr/9.地图的划分1.定义常量#地图抵消的值,等左上角的起...

2020-04-14 04:42:22 466

原创 【Python做游戏】植物大战僵尸-8收集太阳,增加分数

利用pygame模块开发项目迭代开发~github地址:https://github.com/leemamas/pvz演示视频地址:https://www.bilibili.com/video/BV1aC4y1s725/8.收集太阳,增加分数步骤:1.太阳类继续pygame.sprite.Speite()并实现父类的方法,精灵类的好处是:可以实现物体碰撞检测,很方便!...

2020-04-12 18:04:06 330

原创 Python3爬虫实例-爬取双色球开奖记录并保存到数据库

import requestsfrom fake_useragent import UserAgentfrom lxml import etreeimport pymysqlclass SqlHelper(object): def __init__(self): self.connect() def connect(self): s...

2020-04-11 21:45:11 1040

原创 Python3爬虫多线程+xpath实现

多线程爬取糗事百科段子from threading import Threadfrom queue import Queueimport requestsfrom fake_useragent import UserAgentfrom lxml import etreeclass CrawlInfo(Thread): def __init__(self,url_queue...

2020-04-10 21:42:38 223

原创 Python3爬虫使用jsonpath

import requestsfrom fake_useragent import UserAgentfrom jsonpath import jsonpathheaders = { 'User-Agent': UserAgent().chrome}url = 'http://httpbin.org/get'response = requests.get(url, hea...

2020-04-10 20:42:32 128

原创 Python3爬虫Xpath使用

爬取代理实例from lxml import etreeimport requestsfrom fake_useragent import UserAgentheaders={ 'User-Agent':UserAgent().chrome}url='https://www.xicidaili.com/nn/'response=requests.get(url,hea...

2020-04-10 19:59:56 186

原创 Python3爬虫pyquery使用

爬取代理实例from pyquery import PyQuery as pqimport requestsfrom fake_useragent import UserAgentheaders={ 'User-Agent':UserAgent().chrome}url='https://www.xicidaili.com/nn/'response=requests....

2020-04-10 19:04:33 159

原创 Python3爬虫使用re库

爬取糗事百科实例import requestsfrom fake_useragent import UserAgentimport reheaders = { 'User-Agent': UserAgent().chrome}url = 'https://www.qiushibaike.com/text/'response = requests.get(url, he...

2020-04-10 17:08:14 272

原创 【Python做游戏】植物大战僵尸-7太阳生成随机下落

利用pygame模块开发项目迭代开发~github地址:https://github.com/leemamas/pvz演示视频地址:https://www.bilibili.com/video/BV1be411x7u9/7.太阳随机生成并下落步骤:1.创建太阳对象2.定义太阳事件,设置定时器3.执行事件,生成太阳4.渲染,并执行下落动作import pyg...

2020-04-10 13:17:00 385

原创 【Python做游戏】植物大战僵尸-1绘制场景

利用pygame模块开发项目迭代开发~github地址:https://github.com/leemamas/pvz绘制场景演示视频地址:https://www.bilibili.com/video/BV1be411x7u9/步骤:1.初始化pygame2.设置窗体大小3.程序标题名称4.背景图更换5.图片渲染6.退出事件具体实现代码:imp...

2020-04-10 12:36:07 883

原创 Python3爬虫requests使用

get请求import requestsfrom fake_useragent import UserAgentheaders={ 'User-Agent':UserAgent().chrome}url='http://www.xxx.com/s'params={ 'wd':'python'}response=requests.get(url,headers...

2020-04-10 00:48:31 149

原创 Python3爬虫urllib库的使用

访问页面from urllib.request import Request,urlopenurl='http://www.xx.com'req=Request(url)resp=urlopen(req)返回数据html=resp.read().decode()添加报头信息​from fake_useragent import UserAgentheader={...

2020-04-10 00:12:51 147

原创 Window10Wsl下Ubuntu开发python部署

**安装python3指向pythonsudo apt-get install python3 sudo ln -s /usr/bin/python3.6 /usr/bin/python**更换源sudo cp /etc/apt/sources.list /etc/apt/sources.list.baksudo sed -i 's/security.ubuntu/mirror...

2020-03-26 06:38:24 371

原创 Django结合Form组件实现curd功能

urls.pyfrom django.contrib import adminfrom django.urls import pathfrom app import viewsurlpatterns = [ path('admin/', admin.site.urls), path('class_list/',views.class_list ), pa...

2020-03-22 22:40:11 172

原创 Django Form和Ajax提交验证

Form验证views.pyclass LoginForm(Form): usr=fields.CharField(required=True,min_length=5, error_messages={ 'required':'不能为空', ...

2020-03-21 00:42:32 148

原创 Django中间件简单介绍

配置文件添加自定义mid.pyfrom django.utils.deprecation import MiddlewareMixinclass Mid(MiddlewareMixin): def process_request(self, request): print('start') def process_response(self,...

2020-03-14 19:56:13 83

原创 Django分页操作-内置和自定义分页使用

自定义分页最终效果:page.html<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>自定义分页</title></head><body> <ul> ...

2020-03-06 18:40:47 459

原创 Django视图ORM连表操作

正向:根据外键名访问链接的表反向:通过小写表名_set.all()取的def index(request): from app import models #连表(正向操作) list1=models.UserInfo.objects.all() for user in list1: print(user.id,user.pwd,use...

2020-03-06 04:30:57 147

原创 Django视图FBV与CBV

FBVfunction base views 就是在视图里使用函数处理请求。from django.http import HttpResponse def login(request): if request.method == 'GET': return HttpResponse('OK') else: return Http...

2020-03-06 04:22:56 126

原创 Django ORM创建与简单应用CRUD

创建ORMDjango默认使用SQLite数据库,要操作mysql,要利用pymysql1.要创建数据库2.配置settings.pyDATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME':'xxxxx', 'USER': 'root', 'PASSWO...

2020-03-06 02:39:47 182

原创 Django路由系统

普通的url-->函数urls.py:from django.contrib import adminfrom django.http import HttpResponsefrom django.urls import pathdef index(request): return HttpResponse('index')urlpatterns = [ ...

2020-03-05 23:32:13 134

原创 pymysql简单封装

import pymysqlclass SqlHelper(object): def __init__(self): self.connect() def connect(self): self.conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd=...

2020-03-05 12:00:36 152

pygame中文文档.docx

pygame中文文档

2020-03-31

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除