Skip to content

Commit 547951f

Browse files
committed
Write direct
1 parent edb244e commit 547951f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

update_periods.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import json, re, requests, shutil
1+
import json, re, requests
22

33
api_root = "https://vocabs.ardc.edu.au/repository/api/lda/csiro/international-chronostratigraphic-chart/geologic-time-scale-2020/resource.text?uri="
44

@@ -40,7 +40,7 @@ def period_start(period):
4040
lines = f.readlines()
4141

4242
pattern = r"^(.*)(\d+ => Array\(')([\w\s]+)(\',\s*\')([\d\.]+)(',\s*')([\d,]+)('.*)$"
43-
with open("~periods.dat.tmp", "w") as f:
43+
with open("periods.dat", "w") as f:
4444
for line in lines:
4545
match = re.search(pattern, line)
4646
if match:
@@ -57,5 +57,3 @@ def period_start(period):
5757
)
5858
else:
5959
f.write(line)
60-
61-
shutil.copy("~periods.dat.tmp", "periods.dat")

0 commit comments

Comments
 (0)