Python Forum
How to print a global dictionary class properly
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to print a global dictionary class properly
#1
Let's say I have the following class and we know that the code is working properly:

class Test:
    global_dictionary = {}

    def __init__ (self):
        #Initializations here

    def add_to_global_dictionary (self, username):

    def print_global_dictionary (self):
        print (Test.global_dictionary)

test = Test()
test.add_to_global_dictionary("3dimensions"):
test.print_global_dictionary()
Why is the dictionary printed like this: {'3dimensions': <__main__.Test object at 0x...>} ?
Reply


Messages In This Thread
How to print a global dictionary class properly - by 3dimensions - Mar-09-2018, 08:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Print controlled with global-var fmr300 3 1,470 Feb-05-2022, 03:09 PM
Last Post: fmr300
Question How to print each possible permutation in a dictionary that has arrays as values? noahverner1995 2 1,771 Dec-27-2021, 03:43 AM
Last Post: noahverner1995
  Class-Aggregation and creating a list/dictionary IoannisDem 1 1,941 Oct-03-2021, 05:16 PM
Last Post: Yoriz
  Syntax to print ndarray member of class containing ndarray pjfarley3 6 3,263 Jul-09-2020, 06:29 AM
Last Post: pjfarley3
  Dictionary VS Class JKBarnard 2 1,767 Dec-14-2019, 05:37 PM
Last Post: JKBarnard
  [split] Print JSON Dictionary to Excel? venukommu 1 2,312 Nov-15-2019, 09:33 PM
Last Post: micseydel
  Global variable does not seem to be global. Columbo 6 3,730 Jul-15-2019, 11:00 PM
Last Post: Columbo
  dictionary: print key/value with list(dict) comprehension wardancer84 4 3,006 Nov-14-2018, 03:14 PM
Last Post: wardancer84
  user input to select and print data from another class python TyTheChosenOne 6 4,162 Aug-30-2018, 05:53 PM
Last Post: TyTheChosenOne
  Can't get defined random integer to print properly? thb202 1 2,234 Aug-29-2018, 10:15 AM
Last Post: vndywarhol

Forum Jump:

User Panel Messages

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