Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 92 Online
OpenStudy (anonymous):

How do u share global variables across modules using py? :-?

OpenStudy (anonymous):

Modules are a complex topic in Python. See http://docs.python.org/tutorial/modules.html for a full description. But in really simple terms, if you define a variable XX in module M, you can use it by first importing M, then reference the variable as M.XX: In M.py: XX = 17 In use_m.py: import M print M.XX

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Astrid1: CONG ON PURPLE @deadofwinter
28 minutes ago 4 Replies 2 Medals
rose12345: yall someone's bday is today
30 minutes ago 0 Replies 0 Medals
Gucchi: science help
4 minutes ago 4 Replies 2 Medals
Gucchi: science help
44 minutes ago 4 Replies 2 Medals
Gucchi: environmental science help
47 minutes ago 11 Replies 2 Medals
prettygirl15: ac=-3+6x,ab=3x-3, and bx = 9 find x
1 hour ago 1 Reply 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!