Any idea how we can write multiple except on same line as code to be executed for both exceptions is same.
I tried logical OR but it did not work. My code works as expected if I write both exception separately.
except FileNotFoundError:
with open("./file.json", "w") as f:
json.dump(new_data, f, indent=4)
except ValueError:
with open("./file.json", "w") as f:
json.dump(new_data, f, indent=4)