I just started learning about Python Try Except even though I write program in Python for some time. I played with some examples of Python Try Except but for the current scenario, I was wondering if I can combine two Python Try Excepts. Here is an example of two individual Python Try Exceptions
First one:
try:
df = pd.read_csv("test.csv")
except UnicodeDecodeError as error:
print("UnicodeDEcodeErorr")
Second one:
try:
df = pd.read_csv("test.csv", encoding = "ISO-8859-1")
except FileNotFoundError as fnf_error:
print("File not found")
I can keep them as two separate Try Except but I was wondering if there is a way to combine them together.