Avatar ·

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 in a variable inside def, can it be used outside this function? I definitely can't do it. Maybe it's just because I'm a beginner and obvious things are still too complicated for me.

   def   global  urokb_in urokb_in =  1    with   open  ( 'users.txt' ,  'r' )  as  f:  line = f.readline ()  f.close ()   of   open