Can this be easily done in Python?

Mario R. Osorio nimbiotics at gmail.com
Wed Sep 28 19:15:46 EDT 2016


I'm not sure I understand your question, but I 'think' you area talking about executing dynamically chunks of code. If that is the case, there are a couple of ways to do it. These are some links that might interest you:

http://stackoverflow.com/questions/3974554/python-how-to-generate-the-code-on-the-fly

http://stackoverflow.com/questions/32073600/python-how-to-create-a-class-name-on-the-fly

http://lucumr.pocoo.org/2011/2/1/exec-in-python/


On Tuesday, September 27, 2016 at 3:58:59 PM UTC-4, TUA wrote:
> Is the following possible in Python?
> 
> Given how the line below works
> 
> TransactionTerms = 'TransactionTerms'
> 
> 
> have something like
> 
> TransactionTerms = <some Python code here>
> 
> that sets the variable TransactionTerms to its own name as string representation without having to specify it explicitly as in the line above....




More information about the Python-list mailing list