- 博客(13)
- 收藏
- 关注
原创 python 比较文件内容发生变化
需求:比较文件内容是否一直在被修改方案:读文件,每10s计算md5和sha1,比较两次的校验值是否一致,10min内文件若一直被修改则超时缺陷:如果10s后文件被修改无法检测出优化:查阅资料,pynotify应该更方便,有时间再研究#! /usr/bin/env python3# -*- coding:utf-8 -*-import hashlibimport timedef cmp_by_sha1(file_path): with open(file_path, '
2022-03-23 09:51:40
420
转载 解决GitHub下载速度缓慢的问题
转自https://www.jianshu.com/p/0493dcc15d6f防止页面丢失,保存一下随着微软大大宣布GitHub针对个人用户的仓库免费,相信每位开发者都感受到了“真香”。然而因为一些众所周知的原因,国内访问GitHub总会遇到下载速度缓慢、链接意外终止的情况。为了更加愉快地使用全球最大同性交友网站上的优质资源,我们来做一些简单的本机上的调整。通过查看下载链接,能够发现最终被指向到Amazon的服务器(http://github-cloud.s3.am..
2020-06-27 13:15:58
440
原创 Python字符串前面加u,r,b,f是啥意思
加u:后面字符串以 Unicode 格式 进行编码,用在中文字符串前面,防止出现乱码。加r:去掉反斜杠的转义,多用于正则表达式或者文件路径表示。如'\n'不在表示换行,只表示字符'\n'加b:字符串是bytes 类型,用于网络编程,server和client 之间是以bytes进行数据交换加f:字符串内支持大括号内的表达式。ssh.exec_command('kill -9 ' + pid) 相当于ssh.exec_command(f'kill -9 ' {pid})...
2020-05-17 22:57:34
720
原创 基于python实现Verilog语言注释率统计
#encoding=utf-8#import sysimport osimport reimport UIclass Cacu(object): def __init__(self): self.file_type = [] self.DIR_PATH = '' def CalcLines(self, lineList): ...
2020-01-13 21:46:02
777
转载 pip install 安装Python库
1. 在C:\Users\用户名\pip目录下,新建pip.ini2.内容:[global]index-url = http://pypi.douban.com/simple[install]trusted-host=pypi.douban.com3.命令行界面下:pip install --proxy proxyIP:proxyPort [module name]
2018-05-04 15:15:09
1559
原创 ACM (8) 一种排序
#includetypedef struct{ int n, l, w;}D;int compare(D d1, D d2){ if (d1.n > d2.n){ return 1; } else if (d1.n == d2.n){ if (d1.l > d2.l){ return 1; } else if (d1.l == d2.l){ if (d
2017-07-05 14:08:47
459
原创 ACM (7) 街区最短路径问题
#includetypedef struct{ int x, y;}Point;int main(){ freopen("input.txt", "r", stdin); int n; scanf("%d", &n); while (n--){ int m; int x, y; int maxx=0, maxy=0,minx=101,miny=101; int
2017-07-04 19:23:38
563
原创 ACM (6) 喷水装置(一)
//http://acm.nyist.net/JudgeOnline/problem.php?pid=6#include#includeint main(){ freopen("input.txt", "r", stdin); int m; scanf("%d", &m); while (m--){ int N; double r[601]; double temp;
2017-07-04 16:23:06
472
原创 ACM (4) ASCII码排序
//http://acm.nyist.net/JudgeOnline/problem.php?pid=4#include#include//bubble sortint main(){ freopen("input.txt", "r", stdin); int N; scanf("%d", &N); for (int t = 0; t < N; t++){ char s[
2017-07-03 15:12:54
552
原创 ACM (5) Binary String Matching
#include#include#includeint main(){ freopen("input.txt", "r", stdin); int N; scanf("%d", &N); while (N--){ char a[11]; char b[1001]; int count = 0; scanf("%s", a); scanf("%s", b);
2017-07-03 15:04:44
305
原创 ACM (2) 括号配对
//http://acm.nyist.net/JudgeOnline/problem.php?pid=2#include#include#includeint main() { freopen("input.txt", "r", stdin); int N; scanf("%d", &N); for (int i = 0; i char s[10
2017-07-03 14:44:51
344
原创 POJ 2421 minimum spanning tree (prime algorithm)
#include using namespace std;int main(){ //freopen("input.txt","r",stdin); int N; int map[101][101]; int Q; int x,y; int i,j; int bVisited[101]; int minx[101]; while(cin>>N) { for(i=
2015-09-10 22:21:32
320
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人