February 21, 2021
利用fcntl模块可以对一个文件加锁,其它python程序读取这个加锁文件时会阻塞,防止同时读写文件。
官方文档:https://docs.python.org/zh-cn/3.7/library/fcntl.html
基本用法flock(f, operation)
f: 文件描述符 ...
查看更多
February 3, 2021
官方地址:https://github.com/kdlucas/byte-unixbench参考文档:https://www.cnblogs.com/chenshengkai/p/12761467.html一键部署文档:https://unixbench.org
介绍UnixBench ...
查看更多
January 18, 2021
转自任我乐
优秀开源镜像站
企业站
URL
阿里云
mirrors.aliyun.com/
网易
mirrors.163.com/
华为
mirrors.huaweicloud.com/
首都在线
mirrors.yun-idc.com/
搜狐
mir ...
查看更多
December 21, 2020
官方文档 https://cloud.tencent.com/document/product/362/6738
# 腾讯云扩容原有分区(MBR)
wget -O /tmp/devresize.py https://tencentcloud.coding.net/p/tencentclo ...
查看更多
November 3, 2020
textwrap — 文本自动换行与填充官方文档:https://docs.python.org/zh-cn/3/library/textwrap.html
文本裁切wrap 根据限定长度(width)裁切空字符,返回一个列表fill 根据限定长度(width)裁切空字符,返回一个完整字 ...
查看更多
October 29, 2020
官方教程: https://docs.python.org/zh-cn/3/howto/argparse.html完整api:https://docs.python.org/zh-cn/3/library/argparse.html
引入argparse库import argparse
...
查看更多
October 27, 2020
转自阮一峰的网络日志 http://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html
GPL、BSD、MIT、Mozilla、Apache和LGPL
查看更多
October 13, 2020
Linux
简介:protocolbuffer(以下简称PB)是google 的一种数据交换的格式,它独立于语言,独立于平台
编译安装下载:下载地址解压后进入文件安装:
./autogen.sh
./configure
make
make check
sudo make install
校验:
p ...
查看更多
September 28, 2020
Python
mapmap(func, *iterables) –> map objectmap函数相当于把迭代对象的所有项都作为参数执行所给的函数,返回应用后的结果。
>>> iter = [1, 2, 3] # 可迭代对象
>>> func = lambda ...
查看更多
September 28, 2020
import time
from datetime import datetime
# 以下简写string: st, datetime:dt, timestamp:ts
# 把datetime转成字符串
def dt2st(dt):
return dt.strftime(& ...
查看更多