Python
Efan_w
雄关漫道真如铁,而今迈步从头越
展开
-
python空间占用
python2,python3空间占用前言python2python3前言最近使用python写了一个比较大的程序发现,不同的元素占用空间都很大,且python2和python3不一样,列举在下面python2空链表72字节,空字典280字节,空集合232字节,None16字节,char38字节, int绝对值在现在的ns时间戳范围内都是24字节;Python 2.7.16 (default, Sep 6 2021, 07:39:44)[GCC Apple LLVM 12.0.5 (clang原创 2021-11-15 10:44:28 · 1405 阅读 · 0 评论 -
PyPDF2 merge pdf and keep bookmarks
文章目录from __future__ import print_functionfrom sys import argvfrom PyPDF2 import PdfFileMerger, PdfFileReaderimport osclass bookmark_class: def __init__(self, title, page_num, parent = 0): self.page_num = page_num self.parent = pare原创 2021-04-09 14:09:21 · 482 阅读 · 0 评论 -
问题cell-var-from-loop和解决方案
cell-var-from-loopproblemWhen using a loop variable in a closure, the value of this variable will be the same every time(the last value the variable had before the closed function/lambda is called).funcs = [lambda x: x + elem for elem in range(3)]resul原创 2020-12-21 18:08:16 · 769 阅读 · 0 评论 -
python plt相关(设置两轴尺度相同,各个子图占地不一样)
在plt.show()之前加代码plt.gca().set_aspect('equal', adjustable='box')或plt.axis('equal')画二维图时没有问题,但是对于三维图该方法未能解决显示NotImplementedError: It is not currently possible to manually set the aspect on 3D ax...原创 2020-03-16 16:18:17 · 5649 阅读 · 0 评论 -
Ubuntu python监测鼠标键盘响应(pyxhook)
Ubuntu python监测鼠标键盘响应(pyxhook)pyxhook 地址: https://github.com/python-xlib/python-xlibimport pyxhook# 建立全局变量,用于响应控制pause_flag = 0# 建立鼠标响应时间def onMouseEvent(event): global pause_flag pau...原创 2020-02-26 20:36:24 · 1445 阅读 · 0 评论 -
python2,3中数值表示范围 int, float
在python中可以使用sys看,但是在python3中int可以表示无限大的数(实际上受到内存限制)原创 2020-02-04 18:19:17 · 3256 阅读 · 0 评论 -
python 读取txt文件中的数据,删除异样数据,并画图
注意一下几点使用matplotlib在的pyplot包画图使用open打开文件,使用readline()分行读取使用numpy.delete(arrayname,index)删除确定位置处的数据使用and和or而不是&&和||一个figure上画多条线不用hold on, 且线色自动变化代码如下:import matplotlib.pyplot as pltim...原创 2020-01-20 15:40:31 · 931 阅读 · 0 评论