Using global in Python
📁 Advanced Python Topics, Beginner
Hello, I'm learning Python and after C++ I absolutely don't understand the principle of using global variables. If I specify global for a variable inside a def, can I use its value outside this function? I definitely can't get it to work. Maybe it's just because I'm a beginner and obvious things are still too complicated for me.
def check(): global urokb_in urokb_in = 1 with open('users.txt', 'r') as f: line = f.readline() f.close() with open('progress.txt' No answers yet.
Log in to leave an answer