Sep-09-2020, 07:30 AM
I have tried to fix the problem. So looked up the os commands and saw the following used. Problem is I can't get the indentation right no matter where I put it...that line is track_name = line[0] here is the new code.
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], 'race_number' : line[2], 'todays_surface' : line[6], } track_name = line[0] path_dir: str= r"C:\guis\daily_racefiles" filename : str = (track_name + ".csv") path_file = os.sep.join([path_dir, filename]) with open(path_file, 'a') as csv_file: d_writer = csv.DictWriter(csv_file, fieldnames = field) d_writer.writerow(h) my_labeldone= Label( text ="Downloading Complete", fg= "black", font = ("sans_serif" , 16)).place(x=500, y=500I am very frustrated. I have been working on this for 6 hours or so.