From e76ad4f590adfe5e73a0fd37ef879b54ff5b6f82 Mon Sep 17 00:00:00 2001 From: ghobona Date: Mon, 18 Nov 2024 21:49:06 +0000 Subject: [PATCH] Update process.py --- incubation/geolexica-tc211/process.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/incubation/geolexica-tc211/process.py b/incubation/geolexica-tc211/process.py index 3fa682e6..586b0ed7 100644 --- a/incubation/geolexica-tc211/process.py +++ b/incubation/geolexica-tc211/process.py @@ -4,6 +4,7 @@ with open("geolexica.html") as fp: soup = BeautifulSoup(fp, 'html.parser') +cfout = open('./data/tc211/0.csv','w') for term in soup.find_all('tr'): filename = '' @@ -23,7 +24,9 @@ path, headers = urlretrieve('https://isotc211.geolexica.org/api/concepts/'+termid_number+'.json', './data/json/'+filename+".json") for name, value in headers.items(): print(name, value) - + + cfout.write(filename+".json"+','+label+'\n') + with open('./data/json/'+filename+".json") as f: d = json.load(f) fout = open('./data/tc211/'+filename+".adoc",'w') @@ -31,4 +34,5 @@ fout.write("=== "+d['term']+"\n\n") fout.write(d['eng']['definition'][0]['content']+"\n\n") fout.write("(Source: ISO)\n\n") - fout.close() \ No newline at end of file + fout.close() +cfout.close() \ No newline at end of file