0

I have a configuration file which defines a variable

project = "ORB"

using this , I want to rename variable(s) in my code

project_unique_tags  

to

ORB_unique_tags  

notice how only the bold portion in the variable project_unique_tags is to be replaced with the value "ORB" (without the quotes ofcourse)

how to achieve this?

Imran
  • 126
  • 2
  • 17
  • 4
    You [don't](http://stupidpythonideas.blogspot.cl/2013/05/why-you-dont-want-to-dynamically-create.html). – Zero Piraeus Jan 13 '17 at 16:04
  • edited my question to further clarify – Imran Jan 13 '17 at 16:20
  • I think the end of your clarification got cut off ... – Zero Piraeus Jan 13 '17 at 16:21
  • thanks @ZeroPiraeus. edited. – Imran Jan 13 '17 at 16:25
  • It doesn't matter that you only want to create *some* of the variable name dynamically. The question is functionally identical, and the answer is still: **don't**. Again, read the linked article for why. – Zero Piraeus Jan 13 '17 at 16:26
  • ... and, I'm dropping out of the conversation now. You've got a clear pointer that you should be able to understand. – Zero Piraeus Jan 13 '17 at 16:27
  • all I want to do is make the variables more generic by providing a user the ability to specify the project name the script is being run for in a configuration file. Then in my code, I create variables with the names as specified in the configuration file. – Imran Jan 13 '17 at 17:46
  • 1
    @Imran: why would you need to do that? Programs don't normally adjust their variable names for each project or document or image they are run for. Why should the user care about what variables the program uses in the first place? – Martijn Pieters Jan 14 '17 at 14:46

0 Answers0