Apr-24-2017, 07:04 AM
I am starting out in Python. I have a project I am doing and is the reason I took this language. I'm looking to build my own version of card game and the scope of the project involves a lot of variable changing. For now I'm working on a "Profile" file that will contain wins, losses, etc, and a username, you can expect the code to be very basic. Anyhow those values will need to be changed accordingly.
One thing I do not understand clearly is how to change variables between files. I've learned how to read, write, open, close and delete the contents of files. But I can't seem to change variables within them. What I mean by that is this
File A(just short example)
I have read up on globals, and other methods but none seem to physically change the variable on another file. How can I do this?
One thing I do not understand clearly is how to change variables between files. I've learned how to read, write, open, close and delete the contents of files. But I can't seem to change variables within them. What I mean by that is this
File A(just short example)
# This is File A from fileb import bvar bvar = 10It will print 10, but bvar on File B is not changed to 10. It is still 0.
I have read up on globals, and other methods but none seem to physically change the variable on another file. How can I do this?