-
Notifications
You must be signed in to change notification settings - Fork 14
/
calcul.py
34 lines (30 loc) · 878 Bytes
/
calcul.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import re
import os
import numpy as np
import shutil
def calcul():
inpath = r'C:\Users\10696\Desktop\access\zhihu\log\2023-06-30T14_45_24.317925_log.txt'
kk = []
with open(inpath, 'r') as obj:
for i in obj.readlines():
result = re.search('\d+\.\d+', i)
kk.append(float(result[0]))
kk.sort()
kk = kk[:-1]
np.mean(kk)
def choose_noimg():
inpath = r'C:\Users\10696\Desktop\access\zhihu\answer'
outpath = r'C:\Users\10696\Desktop\access\zhihu\tmp'
for i in os.listdir(inpath):
kkk = -9
nth = os.path.join(inpath, i)
if os.path.isfile(nth):
continue
for j in os.listdir(nth):
if '.jpg' in j:
kkk = 9
if kkk < 0:
shutil.copytree(nth, os.path.join(outpath, i))
if __name__ == "__main__":
# calcul()
choose_noimg()