|
try: |
|
with open(path) as inputData: |
|
contents = inputData.read().splitlines() |
|
inputData.close() |
|
return contents |
|
except: |
|
print("File not found!") |
This will catch any error, not just FileNotFoundErrors, so you should catch that error specifically.
You could also get away with not catching this error, as if an error is thrown it will stop executing the code.
Shortest_Path_Graph_Dijkstra/main.py
Lines 20 to 26 in f916007
This will catch any error, not just FileNotFoundErrors, so you should catch that error specifically.
You could also get away with not catching this error, as if an error is thrown it will stop executing the code.