Python Forum
How to convert a string "<... object at POINTER>" to an object?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to convert a string "<... object at POINTER>" to an object?
#1
I want to convert a string "<... object at POINTER>" to an object.
Python version: 3.7.4

class MyClass:
    def Test(self):
        print("Hello!")

c = MyClass()
s = str(c)
print("The value of the string s is", s)
 
c0 = convert_str_to_object(s) # This is undefined but how to fix this?
c0.Test() # This should print "Hello!"
Output:
The value of the string s is <__main__.MyClass object at 0x0000019C9A340908> Hello! (This should appears)
I want to convert the string s back to an object, but how?

The reason:
I want to make a something like a global static variable, but I don't know how do it with the program that's using Python as a script, that's why I convert my object to string then I'm able to store it to the program because it only accepts string, and when I run the script again, I can reuse the object from the stored string. Now you see that it's something like a static object, but I don't know how to do that.
Reply


Messages In This Thread
How to convert a string "<... object at POINTER>" to an object? - by mandaxyz - Aug-08-2020, 06:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing out incidence values for Class Object SquderDragon 3 382 Apr-01-2024, 07:52 AM
Last Post: SquderDragon
  This result object does not return rows. It has been closed automatically dawid294 6 1,357 Mar-30-2024, 03:08 AM
Last Post: NolaCuriel
  TypeError: cannot pickle ‘_asyncio.Future’ object Abdul_Rafey 1 525 Mar-07-2024, 03:40 PM
Last Post: deanhystad
  How can I pause only one object? actualpy 1 413 Feb-01-2024, 07:43 PM
Last Post: deanhystad
  error in class: TypeError: 'str' object is not callable akbarza 2 607 Dec-30-2023, 04:35 PM
Last Post: deanhystad
Question Chain object that have parent child relation.. SpongeB0B 10 1,225 Dec-12-2023, 01:01 PM
Last Post: Gribouillis
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 830 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  TypeError: 'NoneType' object is not callable akbarza 4 1,148 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,520 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  AttributeError: '_tkinter.tkapp' object has no attribute 'username' Konstantin23 4 1,900 Aug-04-2023, 12:41 PM
Last Post: Konstantin23

Forum Jump:

User Panel Messages

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