-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeal_data.py
More file actions
43 lines (42 loc) · 1.43 KB
/
deal_data.py
File metadata and controls
43 lines (42 loc) · 1.43 KB
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
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 26 14:26:05 2018
处理para_inputs.txt的数据,看每个参数的变化.
@author: niu
version: 01
"""
import os
#k值不同的文件夹
d='D:/DMFTdata/two_nnn/find_parameters/20180508/k=1.0/'
for k in range(1,11):
m=k/10
infile=d+'t2_t1={}'.format(m)
os.chdir(infile)
dirs=os.getcwd()
#处理t2_t1=m下的文件夹
for i in range(1,51):
j='{:.2f}'.format(i/100)
# dirs='C:/Users/niu/Desktop/50/'
inf='/'+j+'/para_inputs.txt'
outf='/'+j+'/parameters.txt'
input_dir=dirs+inf
output_dir=dirs+outf
with open(output_dir,'wt') as p,open(input_dir,'rt') as ps:
for index,line in enumerate(ps):
if index % 10==0 and index!=0:
line=line
p.write("\n")
else:
line=line.strip('\n')#去掉每行的换行符
if (index-2) % 10==0:
p.write(line)
elif (index-3) % 10==0:
p.write(line)
elif (index-4) %10==0:
p.write(line)
elif (index-7) % 10==0:
p.write(line)
elif (index-8) % 10==0:
p.write(line)
elif (index-9) % 10==0:
p.write(line)