摘要:
Auth认证系统 from django.contrib.auth import login, logout, authenticate from django.contrib.auth.models import User # 用户登陆 user = authenticate(username, 阅读全文
摘要:
import shutil # 复制文件 shutil.copy(src, dst, *, follow_symlinks=True) # 将以 src 为根起点的整个目录树拷贝到名为 dst 的目录并返回目标目录。 shutil.copytree(src, dst, symlinks=False, 阅读全文
摘要:
import zipfile # 打开一个 ZIP 文件,file 为一个指向文件的路径(字符串) class zipfile.ZipFile(file, mode='r', compression=ZIP_STORED, allowZip64=True, compresslevel=None, * 阅读全文
摘要:
常见的启动方式 scrapy crawl spider_name 官方提供的启动方式 使用脚本启动 import scrapy from scrapy.crawler import CrawlerProcess class MySpider(scrapy.Spider): # Your spider 阅读全文
摘要:
from datetime import datetime, date from bson import ObjectId def dump(o): """ Json格式化方法 :param o: :return: """ if isinstance(o, ObjectId): return str 阅读全文
摘要:
pip install openpyxl 1. 读取文件 import openpyxl # 加载文件 wb = openpyxl.load_workbook("example.xlsx") # 获取所有单元簿的名称 wb.get_sheet_names() # 获取单元簿 sheet = wb.g 阅读全文
摘要:
查看日志 # 查看docker容器的IP docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq) # 查看 2020-01-01 之 阅读全文
摘要:
pwgen sudo yum install pwgen # 生成160个随机密码 pwgen # 生成安全的随机密码 pwgen -s # 生成5个14个字符长度安全的随机密码 pwgen -s 14 5 # 生成超强度随机密码 pwgen -cnys 10 10 openssl # 生成一个14 阅读全文
摘要:
执行Lua脚本 lua hello.lua 运行完指定脚本后进入交互式程序 lua -i hello.lua 在解释器中加载指定脚本 dofile("hello.lua") 直接在命令行运行代码 lua -e "print(math.sin(12))" 加载脚本 lua -l hello.lua - 阅读全文
摘要:
查看防火墙状态 firewall-cmd --state 停止防火墙 systemctl stop firewalld.service 禁止开机启动 systemctl disable firewalld.service 阅读全文