diff --git a/ScrapeJE.py b/ScrapeJE.py index e935e5e..2699403 100644 --- a/ScrapeJE.py +++ b/ScrapeJE.py @@ -88,30 +88,18 @@ print("lista prezzi:",len(prezzo)) #sono stringhe ovvero ci sono anche prezzi co #Crea file json formattato per jawanndenn con la lista dei nomi dei prodotti -#scrive le prime righe del json (uguali ogni volta) -with open('jwndn.json', 'w') as jw: - jw.write("{\n") - jw.write(' "lifetime": "month",\n') - jw.write(' "equal_width": true,\n') - jw.write(' "title":') - jw.write('"') - jw.write(nrist) - jw.write('",') - jw.write("\n") - jw.write(' "options": \n') -#inserisce i nomi dei prodotti dalla lista -def writeListJSONFile(filepathname, lista): - with open('./jwndn.json', 'a+') as f: - json.dump(nome, f) +data = {"lifetime": "month", "equal_width": "true", "title": nrist, "options": nome} -writeListJSONFile('./jwndn.json', nome) +print(json.dumps(data)) -#conclude il json con l ultima parentesi graffa -with open('jwndn.json', 'a+') as jw: - jw.write("\n}\n") +def writeListJSONFile(filepathname): + with open('jwndn.json', 'w') as f: + f.write(json.dumps(data)) +writeListJSONFile('./jwndn.json') + # #storare in "tel" il numero di telefono dle ristorante