I have this code where i am loading JSON files
json_files = glob.glob('JSON/*.json', recursive=True)
Name of json files are as follows:
abc.json
xyz.json
Now i have this function where i am creating a Gantt chart using the JSON files:
def creategantt():
for single_file in uml_files:
with open(Need help here, "w") as f:
# Note: uncomment both 2 lines below if want to start the project XX weeks from today
ago.
# today = datetime.datetime.now().date()
# start_project_date = today + datetime.timedelta(weeks = -8)
f.write("@startuml\nprintscale weekly\nProject starts 2022-08-01\n")
# Extract information for Gantt chart
for stuff in json_data["releases"]:
new_line = "[Release " + stuff["release"] + "] starts " + stuff["start_date"] + "
and
ends " + stuff["end_date"] + "\n"
f.write(new_line)
print(new_line)
f.write("@enduml")
As I have multiple json file what i am trying is to open each json file one by one and create Gannt chart. The gant chart should be saved in a new file as abc.uml and 2nd time when the code runs the new file should be created as xyz.uml. Can someone guide me here how can i create a file using the same name as JSON file name?