Baron Teh
Posts: 4
Nickname: baron
Registered: Jan, 2005
|
|
How to call a class where it's name passed from variable
|
Posted: Nov 9, 2006 5:41 PM
|
|
|
Advertisement
|
Hello all,
I encountered a problem similar to following situation:
1. I have a variable. eg: var1='path'
2. I imported sys module. eg: import sys
3. I need to print sys.path. eg: print sys.path
4. However, i need to pass the "path" from the variable. It becomes : print sys.var1 . However this will cause error.
May i know how shall i resolve this? As my variable is array and i need to recursively call the classes named in the array.
Thanks.
|
|