How do I define a global constant...
sjmachin at lexicon.net
Thu Sep 21 00:28:52 CEST 2006
> How do I define a constant that I can use in my script...
> For example lets say I have a file called constants.py and in there I
> have PI = 3.14
> in my test script I do:
> from constants import *
> How do I access PI later on?
inaccurate_estimate_of_area = PI * radius ** 2 # :-)
You may wish to have a look at the built-in math module:
from math import *
much_better_area = pi * radius ** 2
More information about the Python-list