String Handling


(Doc Holiday) #1

Hallo Python Cracks. I have a big Problem. I hope someone can help. I want to make something like this:

Name = “Sam”

GameLogic.Name = 12345

print Gamelogic.Sam
12345

That’s the Way i want to go. But that dosent work so. How can i handle this? There must be a Way! Please help!

Thx’n Cu, Doc


(Doc Holiday) #2

Name = “Sam”
Order = “GameLogic.”+Name+" = 12345"
exec Order

print GameLogic.Sam
12345

Maybe there is an better Way, but it works for now.
Cu, Doc


(PhaethonH) #3

Name = "Sam"
GameLogic.__dict__[Name] = 12345

print GameLogic.Sam

12345

A bit more “evil”, but a lot more direct. Again, probably something better available.


(Doc Holiday) #4

Thx a lot! That works very well and cracks a lot of Problems a had. :smiley: