From 8288df18a0fb9212e1a2771dab7e90b93af529d2 Mon Sep 17 00:00:00 2001 From: "theo.canaud" Date: Mon, 20 Jun 2022 17:53:02 +0200 Subject: [PATCH] program doesn't stop when error msg appears, instead asks the question again after the error --- Py-Script/courbe.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Py-Script/courbe.py b/Py-Script/courbe.py index bdc5b0e..c08fdea 100644 --- a/Py-Script/courbe.py +++ b/Py-Script/courbe.py @@ -1,8 +1,8 @@ from secrets import choice -from tracemalloc import stop import numpy as np import matplotlib.pyplot as plt import csv +import pandas as pd #"C:\Users\quent\OneDrive\Bureau\ENSC\TransD\Framboisier\02400001.TXT" #! /usr/bin/env python3 @@ -11,13 +11,12 @@ import csv def function(): tab = np.zeros([1,9]) - #def tab_choix(): while True: choice = input("Choisis un fichier csv de 1 à 1862: \n") print("\n") if float(choice) in range(1, 1863): - rawdata = '../RawDataFiles/RawData' + choice + '.csv' + rawdata = '../RawDataFiles/RawData' + choice + '.csv' #Définit le fichier à ouvrir with open(rawdata, newline='') as csvfile: reader = csv.reader(csvfile, quoting=csv.QUOTE_NONNUMERIC) for row in reader: @@ -28,7 +27,6 @@ def function(): elif choice > '1862' or choice < '1': print("{} n'est pas un nombre valide.\n".format(choice)) - exit() x = tab[:,0] y = tab[:,1] @@ -50,4 +48,4 @@ def final(): x, y = function() printFig(x,y) -final() \ No newline at end of file +final()