Sep-07-2020, 01:32 AM
Ok. Hopefully this will be better.
I hope this is easier to deal with.
my_button1 = Button(root, text = "Load Race Files", width = 15, command = load_racefiles) my_button1.place(x=443, y=150) def load_racefiles() : global Race_date count = 0 master_race_file = [] rows = 100 columns = 100 horse_array = [0 for i in range(rows)] file_name = StringVar() f_name = StringVar() fd = open("dirpath", "r") file_dir = (fd.read()) fd.close() os.chdir(file_dir) for f in os.listdir(file_dir): file_name, file_ext = os.path.splitext(f) f_name = file_name + file_ext file_name = file_name.strip()[3:] line_counter = 0 if file_name == Race_date and file_ext == ".jcp": with open(f_name, "r") as csv_file: csv_reader = csv.reader(csv_file) for line in csv_reader: h = {'track' : line[0], 'horse_name' : line[44] } master_race_file.append(h ) my_labeldone= Label( text ="Downloading Complete", fg= "black", font = ("sans_serif" , 16)).place(x=500, y=500)This all works. Now I need to access the dictionaries to see if the track name and the race date selected by the user previous to load_files function is called are equal so I can put that line in a separate smaller list so I can then manipulate the data.
I hope this is easier to deal with.