11 2024 档案
摘要:不用启动运行django项目直接获取django项目的所有mode名称 1、cd到django项目的根目录下 2、终端输入python命令获取django的所有model名称 # 获取django的所有model的指令 python manage.py shell -c "from django.a
阅读全文
摘要:pip install openpyxl import openpyxl def code_main(): xlsx_file_name = r'D:\ljh\work_info\test.xlsx' # excel文件路径 xlsx_data = openpyxl.load_workbook(xl
阅读全文
摘要:# 递归检测文件文件是否存在,存在则重命名文件 def check_file_exists(check_file, original_file=None, num=1): if os.path.exists(check_file): original_file = original_file if
阅读全文
摘要:压缩 1、自定义公共函数zip_files_and_dirs import os import zipfile # 递归检测文件文件是否存在,存在则重命名文件 def check_file_exists(check_file, original_file=None, num=1): if os.pa
阅读全文
摘要:共享服务器-配置电脑网络 1、右键网络,选择属性 2、更改高级共享设置 3、专用网络设置 4、公用网络设置 5、所有网络设置 共享服务器-创建共享文件夹 1、创建共享文件夹(可自定义文件夹名称) 2、右键文件夹属性 3、文件属性-共享 4、添加everyone共享用户,选择"读写"权限 5、文件属性
阅读全文
摘要:自定义数据分页 def paginate_data(data_list, size_page, current_page): """ 数据分页函数 :param data_list: list, 数据列表 :param size_page: int, 每页的数量 :param current_pag
阅读全文
摘要:from reportlab.lib.pagesizes import letter from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph from reportlab.lib import co
阅读全文
摘要:RSA加密和解密是一种常见的非对称加密方法,主要用于保护数据的安全性。在RSA加密中,使用公钥对数据进行加密,使用私钥进行解密。 pip install pycryptodome from Crypto.PublicKey import RSA from Crypto.Cipher import P
阅读全文
摘要:获取电脑 操作系统、CPU、内存、磁盘等信息。 pip install platform pip install psutil 通过使用platform库获取基本的操作系统和处理器信息,并使用psutil库检索更多详细的系统资源状态,如CPU频率、内存状态和磁盘使用情况。 调用get_compute
阅读全文
摘要:通用查询 1、公共函数: def generic_query(model, filter_kwargs=None, order_by=None, limit=None, aggregate=None, annotate=None): """ 通用的 Django ORM 查询函数。 :param m
阅读全文
摘要:查看已连接的wifi列表 win+R,打开控制台窗口,输入: netsh wlan show profiles 从wifi列表中查看指定wifi的秘密 1.输入指令: netsh wlan show profile name="wifi名" key=clear name要查看的wifi名称,key=
阅读全文
摘要:DATABASES配置 在Django的配置文件 setting.py 中的DATABASES参数中,添加多个数据库的配置信息。每个数据库都需要指定ENGINE(数据库引擎)和NAME(数据库名称)。 DATABASES = { 'default': { 'ENGINE': 'django.db.b
阅读全文
摘要:1、netstat命令 netstat 用于显示网络状态信息的命令。可查看特定端口是否被占用: netstat -tuln | grep 端口号 -t: 显示 TCP 连接信息 -u: 显示 UDP 连接信息 -l: 仅显示监听状态的端口 -n: 使用数字格式显示端口号,而不是服务名 grep 端口
阅读全文