0
string = 's1'
result = function()

I want name of variable returning from function as s1 instead of result

s1 = object of some class returned from function() # that's how it should be

*****edit******

I want to make s = 10. and it is NOT answered, i have checked.

a = 's'

globals()['a'] = 10

print s
Hamad
  • 21
  • 1
  • 7
  • 2
    Related and/or possible duplicate: [How do I do variable variables in Python?](http://stackoverflow.com/q/1373164/953482) – Kevin Jul 31 '15 at 14:19
  • See [_Why you don't want to dynamically create variables_](http://stupidpythonideas.blogspot.com/2013/05/why-you-dont-want-to-dynamically-create.html). – martineau Jul 31 '15 at 14:40
  • Ok i figured it out... Thanks everyone! locals()[a] = 10 is the answer – Hamad Jul 31 '15 at 15:07

0 Answers0