Python Forum
Help accessing elements of list of dictionaries
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help accessing elements of list of dictionaries
#5
I changed the code as you suggested. Here is the result... where as before adding your code no error message.


$ python hello2.py
Traceback (most recent call last):
File "hello2.py", line 1283, in <module>
master_race_file = load_racefiles()
File "hello2.py", line 1164, in load_racefiles
if file_name == Race_date and file_ext == ".jcp":
NameError: name 'Race_date' is not defined

I changed the code and put it like this. And it works. But problem is I am still in the load_races function

master_race_file.append(h ) 
			
				my_labeldone= Label( text ="Downloading Complete", fg= "black", font = ("sans_serif" , 16)).place(x=500, y=500)
	print( master_race_file[0]['todays_race_classification'])
I wanted to access the info outside the function.
Reply


Messages In This Thread
RE: Help accessing elements of list of dictionaries - by Milfredo - Sep-06-2020, 10:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 709 Apr-29-2024, 04:38 PM
Last Post: Calab
  unable to remove all elements from list based on a condition sg_python 3 563 Jan-27-2024, 04:03 PM
Last Post: deanhystad
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 548 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  Access list of dictionaries britesc 4 1,198 Jul-26-2023, 05:00 AM
Last Post: Pedroski55
  Checking if a string contains all or any elements of a list k1llcod3 1 1,214 Jan-29-2023, 04:34 AM
Last Post: deanhystad
  How to change the datatype of list elements? mHosseinDS86 9 2,129 Aug-24-2022, 05:26 PM
Last Post: deanhystad
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 5,358 May-17-2022, 11:38 AM
Last Post: Larz60+
  Why am I getting list elements < 0 ? Mark17 8 3,277 Aug-26-2021, 09:31 AM
Last Post: naughtyCat
  Looping through nested elements and updating the original list Alex_James 3 2,213 Aug-19-2021, 12:05 PM
Last Post: Alex_James
  Extracting Elements From A Website List knight2000 2 2,413 Jul-20-2021, 10:38 AM
Last Post: knight2000

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020