I'm working with python 3.4.1 interpreter in pycharm. I'm trying to do several things on a changing number of variables. I'v found it convenient to use exec() in order of changing the variable name and execute the same command on a different variable name. After doing it successfully for some time, for some reason, errors started to appear. Those errors happened because I had variables initialization within an exec() command so they weren't recognized by the interpreter. While changing those lines and removing unnecessary variables, I wrote one command that seems to be running just fine when executes in python console, but won't run in run time or debugging mode. Usually I use the console as a expression evaluator, so it helps me understand and correct wrong commands, but this time it seems to be the right command and still nothing happens when i'm running the script.
This is the code, doc2text_path was initialized erlier:
$newdir = ""
exec("newdir = " + "doc2text_path%s" % scrape_number)
The command executes and the value of newdir remains "".
newdir is a new variable that i want to create, doc2txt_path is a string variable containing the path of a file I want to write in to later on. I have about 4 files like that one all referred to with variables in following name format: doc2text_path and a serial number: doc2text_path1 doc2text_path2 etc' That way i can use a for loop in order of referring to each one of them.
thanks.