Я пытаюсь использовать обработку исключений для предотвращения сбоя моей системы, я использовал приведенные ниже коды, где этот файл CSV на самом деле не существует. Но система постоянно дает мне ответ. Может кто-нибудь помочь мне исправить мои коды, пожалуйста .... помогите мне, пожалуйста
Это мои исходные коды:
while True:
try:
import pandas as pd # data processing, csv file I/O(e.g pd.read_csv)
df = pd.read_csv('C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv')
print(df)
except Exception as err:
print("Uh oh, please send me this message: '{}'" .format(err))
результаты:
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
Uh oh, please send me this message: '[Errno 2] File b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv' does not exist: b'C:/Users/User/Desktop/Coding/parsehubjsonfileeg/assd.csv''
..................