Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53957 > unrolled thread
| Started by | chandan kumar <chandan_psr@yahoo.co.in> |
|---|---|
| First post | 2013-09-11 20:50 +0800 |
| Last post | 2013-09-11 20:50 +0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
global variable across modules chandan kumar <chandan_psr@yahoo.co.in> - 2013-09-11 20:50 +0800
| From | chandan kumar <chandan_psr@yahoo.co.in> |
|---|---|
| Date | 2013-09-11 20:50 +0800 |
| Subject | global variable across modules |
| Message-ID | <mailman.247.1378903988.5461.python-list@python.org> |
Hi , I'm trying to understand using global variable across different modules.Here is what i have tried so far without much success.Please ignore any indentation issue in the below code. Filename:Test1.py Debug_Value = " " import Test2 def globalValmethod(): global Debug_Value Debug_Value =10 Test2.globalValTest() globalValmethod() -----Execute the method Filename:Test2.py import Test1 from Test1 import * def globalValTest() print "Golabal Value" Debug_Value In Test2.py file I wanted to print the global value ,Debug_Value as 10.I'm not getting expected result.Please can any one point where exactly i'm doing wrong. Similarly , how can i use global variable inside a class and use the same value of global variable in different class?Is that possible?if Yes please give me some pointers on implementing. Best Regards, Chandan
Back to top | Article view | comp.lang.python
csiph-web