随笔分类 -  python小工具

摘要:#### 坐标系转换 ```python """ 坐标转换工具类 xll >2021-05-19 developer """ import math import pandas as pd import numpy as np from pyproj import Proj, transform, 阅读全文
posted @ 2023-09-08 14:47 是阿杰呀 阅读(398) 评论(0) 推荐(0) 编辑
摘要:```python from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger def main(object_list, page_index, display_num=10): """ :param objec 阅读全文
posted @ 2023-08-16 15:05 是阿杰呀 阅读(13) 评论(0) 推荐(0) 编辑
摘要:draw_gif.py import os import io import imghdr import imageio.v2 as imageio from PIL import Image, ImageDraw, ImageFont import numpy as np from PIL imp 阅读全文
posted @ 2023-02-01 10:00 是阿杰呀 阅读(296) 评论(0) 推荐(0) 编辑
摘要:subprocess使用 import subprocess p = subprocess.Popen('ls -l', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1) bufsize: 缓冲区大小. 当创 阅读全文
posted @ 2022-12-16 16:08 是阿杰呀 阅读(104) 评论(0) 推荐(0) 编辑
摘要:1. 管理员权限打开 powershell 2. 打开 winrm服务 查看 winrm service的运行状态, 默认情况没有开启, 执行命令为空 代表没有启动. winrm enumerate winrm/config/listener 对 winrm service进行配置 winrm qu 阅读全文
posted @ 2022-12-16 12:39 是阿杰呀 阅读(742) 评论(0) 推荐(0) 编辑
摘要:1. 连接 linux import paramiko # pip install paramiko def main(ip, port, username, password): res_data = [] ssh = paramiko.SSHClient() ssh.set_missing_ho 阅读全文
posted @ 2022-12-13 14:56 是阿杰呀 阅读(419) 评论(0) 推荐(0) 编辑
摘要:解压 .zip文件 import zipfile fz = zipfile.ZipFile(zip_file_path, 'r') # 解压文件路径 for file in fz.namelist(): fz.extract(file, result_folder_path) # 文件名, 目标文件 阅读全文
posted @ 2022-11-29 11:45 是阿杰呀 阅读(54) 评论(0) 推荐(0) 编辑
摘要:文件夹压缩 zip import zipfile srmdir_all_folder # 文件夹路径 print('原始文件夹路径: ', srmdir_all_folder) zip_name = 'srmdir_all.zip' # 压缩文件名称 zip_file_path = srmdir_a 阅读全文
posted @ 2022-11-25 10:25 是阿杰呀 阅读(1369) 评论(0) 推荐(1) 编辑
摘要:筛选满足条件的数据行 # df df[(df['name'] == 'name1') &(df['sex'] == 'male')] 更改相关参数 # df1, df2 a = df1[(df1['企业名称'] == value) & (df1['统一社会信用代码'] == code)]['法定代表 阅读全文
posted @ 2022-11-22 15:53 是阿杰呀 阅读(293) 评论(0) 推荐(0) 编辑
摘要:1. ~/.bashrc 配置 export WORKON_HOME=$HOME/.virtualenvs # virtualenv folder path source /usr/local/bin/virtualenvwrapper.sh # which virtualenvwrapper.sh 阅读全文
posted @ 2022-11-11 10:32 是阿杰呀 阅读(23) 评论(0) 推荐(0) 编辑
摘要:后台实现下载接口 1.1 通过文件流下载 import os import time from django.http import StreamingHttpResponse def download_file_blob(name, url): """ :param name: 文件名称(带后缀) 阅读全文
posted @ 2022-11-04 16:19 是阿杰呀 阅读(581) 评论(0) 推荐(0) 编辑
摘要:文件解压 # -*- coding: utf-8 -*- import os import sys import time import shutil import filetype import gzip import tarfile import zipfile class FileUtils: 阅读全文
posted @ 2022-09-08 10:29 是阿杰呀 阅读(101) 评论(0) 推荐(0) 编辑

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