consider-using-with
This commit is contained in:
parent
5c5ce02fc1
commit
885fa98e4b
@ -273,5 +273,5 @@ def create_empty_files(dir_out, net):
|
|||||||
|
|
||||||
for i in range(7481):
|
for i in range(7481):
|
||||||
name = "0" * (6 - len(str(i))) + str(i) + '.txt'
|
name = "0" * (6 - len(str(i))) + str(i) + '.txt'
|
||||||
ff = open(os.path.join(dir_out[net], name), "a+")
|
with open(os.path.join(dir_out[net], name), "a+"):
|
||||||
ff.close()
|
pass
|
||||||
|
|||||||
@ -161,8 +161,8 @@ def read_and_rewrite(path_orig, path_new):
|
|||||||
line_new = temp_1 + ' ' + hwl + ' ' + temp_2 + '\n'
|
line_new = temp_1 + ' ' + hwl + ' ' + temp_2 + '\n'
|
||||||
ff.write("%s" % line_new)
|
ff.write("%s" % line_new)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
ff = open(path_new, "a+")
|
with open(path_new, "a+"):
|
||||||
ff.close()
|
pass
|
||||||
|
|
||||||
|
|
||||||
def find_cluster(dd, clusters):
|
def find_cluster(dd, clusters):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user