Python Forum
passing dictionary to the function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing dictionary to the function
#3
I think the OP is asking about something more like this:
stuff = [{'key1': 1, 'key2': 2}, {'key': 1, 'key2: 4}]
or maybe
stuff = {"dict1": {'key1': 1, 'key2': 2}, "dict2": {'key': 1, 'key2: 4}}
Either way you use indexing to get the dictionaries you want to compare.
compare(stuff[0], stuff[1])
compare(stuff["dict1"], stuff["dict2"])
Reply


Messages In This Thread
passing dictionary to the function - by mark588 - Dec-19-2022, 06:20 PM
RE: passing dictionary to the function - by deanhystad - Dec-19-2022, 07:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing flags to python script, through a function xbit 4 4,039 Apr-20-2021, 06:32 AM
Last Post: ndc85430
  Writing a lambda function that sorts dictionary GJG 1 2,046 Mar-09-2021, 06:44 PM
Last Post: buran
  Using Dictionary to Test Evenness of Distribution Generated by Randint Function new_coder_231013 6 3,344 Feb-23-2021, 01:29 PM
Last Post: new_coder_231013
  Passing argument from top-level function to embedded function JaneTan 2 2,292 Oct-15-2020, 03:50 PM
Last Post: deanhystad
  passing variable to function Rejoice 4 2,909 Sep-11-2020, 03:27 AM
Last Post: Pleiades
  Mathplotlib - passing reference to axs to function qmfoam 5 3,010 Aug-17-2020, 09:02 PM
Last Post: qmfoam
  Passing variable to another function JonnyDriller 10 3,837 Feb-05-2020, 03:46 AM
Last Post: JonnyDriller
  Passing Values of Dictionaries to Function & Unable to Access Them firebird 3 2,622 Aug-03-2019, 10:25 PM
Last Post: firebird
  How to pass a dictionary as an argument inside setup function of unittest nilaybnrj 1 3,238 May-11-2019, 03:18 AM
Last Post: keames
  Passing a local variable outside of a function malonn 8 3,999 Apr-15-2019, 01:50 AM
Last Post: malonn

Forum Jump:

User Panel Messages

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