自动从文件匹配数值并计算总和
该脚本自动从文档中匹配两个字符串之间的数字,并计算其总和。 import re numlist = total = 0 f = open "a.txt", encoding='utf8' line = f.readline while line: result = re.findall ". successNum . failedNum. ", line if result
该脚本自动从文档中匹配两个字符串之间的数字,并计算其总和。 import re numlist = total = 0 f = open "a.txt", encoding='utf8' line = f.readline while line: result = re.findall ". successNum . failedNum. ", line if result
import arrow import datetime from chinese calendar import is workday def isLeapYear years : if years % 4 == 0 and years % 100 = 0 or years % 400 == 0 : days sum = 366 return days sum else: days
vi /etc/elasticsearch/elasticsearch.yml 取消注释并修改如下: network.host: 0.0.0.0 cluster.initial master nodes: "node 1", "node 2" 重启elasticsearch: systemctl restart elasticsearch
推荐python3运行该脚本,作用就是统计服务器新增文件及其路径、大小。 import time import datetime import os dirname = localtime = time.mktime time.strptime datetime.datetime.now .strftime "%Y %m %d" , "%Y %m %d" aftertime
推荐python3运行该脚本。 import time import datetime import os dirname = localtime = time.mktime time.strptime datetime.datetime.now .strftime "%Y %m %d" , "%Y %m %d" aftertime = time.mktime time.s
from urllib import request from lxml import etree import time for pagenum in range 330,400 : 伪造头信息 headers = { "User Agent":"Mozilla/5.0 Windows NT 10.0; Win64; x64 AppleWebKit/537.36 KHTML, like
由于意外关闭,linux 中秘钥的权限会跟着更改,至于原因暂时未知,解决办法如下: cd /etc/ssh chmod 400 ./ sudo systemctl restart sshd xshell再次连接,成功。