program doesn't stop when error msg appears, instead asks the question again after the error
This commit is contained in:
parent
930d91cfa9
commit
8288df18a0
|
@ -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()
|
||||
final()
|
||||
|
|
Loading…
Reference in a new issue