I have a program where I need to get information from one of many instances of a class from just a string variable.
I've asked a programmer friend of mine for help but he's specialised in C# rather than python3 so the best he could offer was to try using the exec() command. This didn't really help me.
Say I have some code setting up information about cars
class Cars:
def __init__(self, Brand, Model, Owner):
self.Brand = Brand
self.Model = Model
self.Owner = Owner
Car1 = Cars("Honda", "Civic", "Jon Arbuckle")
Car2 = Cars("Ford", "Focus", "Martha Jones")
MysteryCar = "Car1"
Is there anyway to return the value "Jon Arbuckle" from only knowing what's stored in MysteryCar?