使用python在不改变原有excel的格式下,修改指定单元格格式 参考了https://segmentfault.com/q/1010000008270267。有一个账单,需要生成一个副本,但是需要将交易员列隐藏,不能改变原有的格式。xlsx的文件容易实现,使用openpyxl实现。xls的文件使用xlrd+xlutil实现。
解决uuid/uuid.h:No such file or directory 在编译项目的时候报错,uuid/uuid.h:No such file or directory,按照网上的装了很多包,例如uuid-devel uuid e2fsprogs-devel,但是还是报错,最后又装了libuuid-devel解决了。
python subprocess 获取到的pid总是比实际的小1 现象python subprocess 获取到的pid总是比实际的小1问题描述代码如下:用的subprocess.Popen,shell设置为True,有时候获取到的pid为实际的-1p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=path_of_strategy) # stdout, stderr = p.communicate() p
pytest报错ModuleNotFoundError No module named ‘extensions‘ 问题pytest报错ModuleNotFoundError No module named ‘extensions’___________________________________________________________________________________________________________________________________ ERROR collecting tests/extensions/test_utils.py ________________
flask-socketio实现简单websocket通信 flask-socketio实现简单websocket通信from app import socketio, emit, appfrom flask import requesttasks = {}class MonitorTask(object): def __init__(self, username, sid): self._running = True self.username = username self.sid = s
误删liblber-2.4.so.2后无法ssh,无法scp 问题描述误删liblber-2.4.so.2后无法ssh,无法scp,但是当前的连接还没断开解决办法从另一个节点起nfs服务,mount相对应的目录,然后把liblber-2.4.so.2拷过来 放到对应的目录下起nfs服务apt install nfs-kernel-server # 安装nfs服务端vi /etc/exports # 修改配置文件,加/yourpath *(rw,sync,no_subtree_check)exportfs -fa # 重新加载配置sudo system
python读取文件时,文件有内容,但是readline却为空 问题描述python读取文件时,文件有内容,但是readline却为空原因f = open('a.txt', 'w+')data = f.readline()w+会默认清空文件换成r+模式即可想要读文件,并且要覆盖原有的内容with open('a.txt', 'r+') as f: content = f.readline() f.seek(0) f.truncate() f.write("some other content")注意在编辑器里调试的时候打了断点,并且执行了
gunicorn多worker之间实现共享数据 问题描述单进程启动时,全局变量的读写都没有问题,但是用gunicorn起的多worker,全局变量没法共享原因gunicorn多worker之间,数据没办法用全局变量共享解决方法因为需要同时修改数据,并且共享,所以选择共享文件的方式解决class BaseIncrease(object): _instance_lock = threading.Lock() num = None date = None _instance = None data_type
获取指定字符串+递增数字的字符串 class BaseIncrease(object): _instance_lock = threading.Lock() num = None date = None _instance = None @classmethod @abc.abstractmethod def get_init_num(cls): pass @classmethod @abc.abstractmethod def get_se
python获取汉字首字母(多音字也可) from pypinyin import Style, lazy_pinyinprint(''.join(lazy_pinyin("快乐2015TY", style=Style.FIRST_LETTER)).upper())
netty UDP组播调优记录 问题:java使用netty接收UDP组播存在丢包现象确定是否因为udp缓冲区太小导致丢包watch -n 1 -d 'cat /proc/net/udp >> /usr/udpDump.txt'# 观察输出 rx_queue不为0,且drop数在不断增加,表示接收缓冲区有堆积现象,drops不断增加存在丢包现象 sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeo
linux用户管理常用命令 [root@localhost data]# useradd agent # 新增用户agent,agent属组为agent[root@localhost data]# useradd test # 新增用户test,test属组为test[root@localhost scripts]# chmod +x test.sh # 增加执行权限[root@localhost quantitative-manager_agent]# groupadd g_group # 添加g_group组
linux离线安装完python3,import ssl报错找不到_ssl 问题linux离线安装完python3,import ssl报错找不到_ssl解决方法安装openssl-devel后重新编译安装python3yum install openssl-devel # 安装openssl-devel安装参考linux离线安装pythonpython离线包下载地址