Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 11 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
kaelynw: art igg
12 minutes ago 8 Replies 1 Medal
XShawtyX: Art
15 hours ago 6 Replies 0 Medals
Nina001: teach me how to draw or just tell me the basics
17 hours ago 2 Replies 1 Medal
XShawtyX: We doing another drawing gimme ideas to add to this
18 hours ago 9 Replies 1 Medal
RAVEN69: What is x 3+y 3+z 3=k
22 hours ago 20 Replies 1 Medal
cinna: Who is good with photo editing? Dm me pls
1 day ago 2 Replies 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!