webscraper/app/scraper.py

18 lines
329 B
Python
Raw Normal View History

2024-11-12 05:16:21 +01:00
import os
import json
def scraper():
directory = "dist"
file_path = os.path.join(directory, "data.json")
data = []
try:
os.mkdir("dist")
except FileExistsError:
pass
with open(file_path, "w", encoding="utf-8") as file:
json.dump(data, file)
print("Data has been scraped!")