Python Forum
Python help with module function return dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python help with module function return dictionary
#3
On each iteration of your loop the dictionary over writes the same two keys. Would it be preferable to use a list instead or on each loop the key names will need changing to something unique to the dictionary each time.

If you want the two keys values to be a list, first asign each of them as a list outside of the loop then inside the loop append to the list of each key.
Reply


Messages In This Thread
RE: Python help with module function return dictionary - by Yoriz - Oct-15-2016, 12:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  nested function return MHGhonaim 2 729 Oct-02-2023, 09:21 AM
Last Post: deanhystad
  return next item each time a function is executed User3000 19 2,611 Aug-06-2023, 02:29 PM
Last Post: deanhystad
  function return boolean based on GPIO pin reading caslor 2 1,306 Feb-04-2023, 12:30 PM
Last Post: caslor
  passing dictionary to the function mark588 2 1,070 Dec-19-2022, 07:28 PM
Last Post: deanhystad
  return vs. print in nested function example Mark17 4 1,863 Jan-04-2022, 06:02 PM
Last Post: jefsummers
  How to invoke a function with return statement in list comprehension? maiya 4 2,997 Jul-17-2021, 04:30 PM
Last Post: maiya
  Function - Return multiple values tester_V 10 4,708 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Get return value from a threaded function Reverend_Jim 3 17,535 Mar-12-2021, 03:44 AM
Last Post: Reverend_Jim
  Writing a lambda function that sorts dictionary GJG 1 2,070 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,440 Feb-23-2021, 01:29 PM
Last Post: new_coder_231013

Forum Jump:

User Panel Messages

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