0

Hi,

I need to define some common variables in one file and use that file in my python script , Like in php we define some variable in (eg :definevble.config) file, later we will use that file using include method in php script.

Plz let me know how to do this in pyhon.


Thanks
-Shyami

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by shyami
0

You put your variable definitions in a .py file you could name it definevble.py if you wanted to.

Then from the other python file (.py) that wanted the variables you add a line:

from definevble import *

That imports everything in that file into this file.

I think that will do what you want.

For example if vardefs.py contains:

pie="Apple"

and vartest.py contains:

from vardefs import *
print pie

The output of vartest.py will be "Apple"

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.