随笔分类 -  模块化

摘要:tkinter日期控件 内容主要来自互联网上整理 import calendar import tkinter as tk import tkinter.font as tkFont from tkinter import ttk datetime = calendar.datetime.datet 阅读全文
posted @ 2021-11-22 16:23 一只小小的寄居蟹 阅读(2348) 评论(0) 推荐(0) 编辑
摘要:pyinstaller是一个非常简单的打包python的py文件的库, 把py文件打包成exe文件,方便给小白执行程序。 官网介绍 http://www.pyinstaller.org/ 安装 pip install pyinstaller 使用PyInstaller生成exe文件 Pyinstal 阅读全文
posted @ 2021-11-22 15:59 一只小小的寄居蟹 阅读(929) 评论(0) 推荐(0) 编辑
摘要:联网环境 虚拟环境常用命令 从开始菜单运行“Anaconda Prompt”,出现的界面输入创建虚拟环境的指令。 创建了一个名字为v1,且基于python版本3.6的虚拟环境。 在创建过程中需要回复(y/n),Yes。 conda create -n v1 python==3.6 激活虚拟环境 查看 阅读全文
posted @ 2021-09-17 15:56 一只小小的寄居蟹 阅读(1376) 评论(0) 推荐(0) 编辑
摘要:官方网站: https://github.com/kennethreitz/records 连接数据库 Records使用sqlalchemy的create_engine,DBAPI可以完全参照sqlalchemy文档 """PostgreSQL""" # default db = records. 阅读全文
posted @ 2020-11-13 10:52 一只小小的寄居蟹 阅读(1961) 评论(0) 推荐(0) 编辑
摘要:Install the python package $pip install jupyter_contrib_nbextensions $conda install -c conda-forge jupyter_contrib_nbextensions Install javascript and 阅读全文
posted @ 2020-11-09 10:27 一只小小的寄居蟹 阅读(2527) 评论(0) 推荐(0) 编辑
摘要:python 删除文件某一行 #!/usr/bin/python # -*- coding: utf-8 -*- # @Time : 2020/6/29 15:06 # @Author : hyang # @File : delLine.py # @Software: PyCharm import 阅读全文
posted @ 2020-07-01 16:33 一只小小的寄居蟹 阅读(7743) 评论(0) 推荐(0) 编辑
摘要:pandas过滤文件重复行 import pandas as pd import os import argparse import random import string # 增加参数 parser = argparse.ArgumentParser( description="过滤文件重复行, 阅读全文
posted @ 2020-03-06 10:19 一只小小的寄居蟹 阅读(965) 评论(0) 推荐(0) 编辑
摘要:介绍 Xlsx是python用来构造xlsx文件的模块,可以向excel2007+中写text,numbers,formulas 公式以及hyperlinks超链接。 可以完成xlsx文件的自动化构造,包括: 合并单元格,制作excel图表等功能: xlsxWriter支持多种excle功能;与ex 阅读全文
posted @ 2020-03-02 00:42 一只小小的寄居蟹 阅读(1142) 评论(0) 推荐(0) 编辑
摘要:解压缩zip文件 import zipfile import os.path import os class ZFile(object): """ 文件压缩 """ def zip_file(self, fs_name, fz_name): """ 从压缩文件 :param fs_name: 源文件 阅读全文
posted @ 2020-01-22 16:55 一只小小的寄居蟹 阅读(10150) 评论(1) 推荐(1) 编辑
摘要:函数重做的装饰器 def retry_times(attempt): def decorator(func): def wrapper(*args, **kw): att = 0 while att < attempt: try: return func(*args, **kw) except Ex 阅读全文
posted @ 2020-01-20 17:22 一只小小的寄居蟹 阅读(135) 评论(0) 推荐(0) 编辑
摘要:1.下载UnRAR.exe,与python文件放在同一目录下 2.使用rarfile模块 代码: def rar_f(self, fz_name, path): """ 解压缩文件 :param fz_name: zip文件 :param path: 解压缩路径 :return: """ flag 阅读全文
posted @ 2020-01-14 17:19 一只小小的寄居蟹 阅读(214) 评论(0) 推荐(0) 编辑
摘要:windows (1)打开文件资源管理器(文件夹地址栏中) (2)地址栏上面输入 %appdata% (3)在这里面新建一个文件夹 pip (4)在pip文件夹里面新建一个文件叫做 pip.ini ,内容写如下即可 [global] timeout = 6000 index-url = https: 阅读全文
posted @ 2019-12-12 09:47 一只小小的寄居蟹 阅读(509) 评论(0) 推荐(0) 编辑
摘要:python对不同类型文件的字符查找 TXT文件: def txt_handler(self, f_name, find_str): """ 处理txt文件 :param file_name: :return: """ line_count = 1; file_str_dict = {} if os 阅读全文
posted @ 2019-12-11 10:06 一只小小的寄居蟹 阅读(1049) 评论(0) 推荐(0) 编辑
摘要:Tushare是一个免费、开源的python财经数据接口包。主要实现对股票等金融数据从数据采集、清洗加工 到 数据存储的过程,能够为金融分析人员提供快速、整洁、和多样的便于分析的数据,为他们在数据获取方面极大地减轻工作量,使他们更加专注于策略和模型的研究与实现上。考虑到Python pandas包在 阅读全文
posted @ 2019-09-23 16:46 一只小小的寄居蟹 阅读(1306) 评论(0) 推荐(1) 编辑
摘要:Matplotlib简介 Matplotlib 是 Python 的绘图库。 它可与 NumPy 一起使用,提供了一种有效的 MatLab 开源替代方案。 导入库 常用方法 画布与子图 画折线图 图一 常用参数 线条方式 点型 图二 图三 移动坐标轴 图例变化 bar图 pie图 阅读全文
posted @ 2019-09-20 22:47 一只小小的寄居蟹 阅读(684) 评论(0) 推荐(0) 编辑
摘要:pandas简介 1、pandas是一个强大的Python数据分析的工具包。2、pandas是基于NumPy构建的。 3、pandas的主要功能 具备对其功能的数据结构DataFrame、Series 集成时间序列功能 提供丰富的数学运算和操作 灵活处理缺失数据 4、安装方法:pip install 阅读全文
posted @ 2019-09-18 11:25 一只小小的寄居蟹 阅读(875) 评论(1) 推荐(0) 编辑
摘要:NumPy是高性能科学计算和数据分析的基础包。 读取文件 world_alcohol.txt的文件,文件格式如下 文件内容的含义:(这是一份全球的饮料消耗记录表,第一列的意思是记录的年份,第二列指的是饮料的出产地,第三列指的是饮料的消耗地,第四列指的是饮料的类型,第五列指的是饮料的每人平均消耗量) 阅读全文
posted @ 2019-07-11 11:28 一只小小的寄居蟹 阅读(926) 评论(0) 推荐(0) 编辑
摘要:笛卡尔积:itertools.product(*iterables[, repeat]) 两个元组进行笛卡尔积: 排列:itertools.permutations(iterable[, r]) 组合:itertools.combinations(iterable, r) 组合(包含自身重复):it 阅读全文
posted @ 2019-05-14 14:02 一只小小的寄居蟹 阅读(25348) 评论(1) 推荐(3) 编辑
摘要:pdfplumber简介 Pdfplumber是一个可以处理pdf格式信息的库。可以查找关于每个文本字符、矩阵、和行的详细信息,也可以对表格进行提取并进行可视化调试。 文档参考https://github.com/jsvine/pdfplumber pdfplumber安装 安装直接采用pip即可。 阅读全文
posted @ 2019-03-08 16:38 一只小小的寄居蟹 阅读(23730) 评论(1) 推荐(1) 编辑
摘要:Python中默认安装的ftplib模块定义了FTP类,可用来实现简单的ftp客户端,用于上传或下载文件。 ftplib模块常用方法 FTP.quit()与FTP.close()的区别 FTP.quit():发送QUIT命令给服务器并关闭掉连接。这是一个比较“缓和”的关闭连接方式,但是如果服务器对Q 阅读全文
posted @ 2018-09-21 16:35 一只小小的寄居蟹 阅读(25159) 评论(1) 推荐(1) 编辑

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