Hello, I meet Python and after C ++ I categorically do not understand the principle of using Global variables. If you indicate Global in the variable in Def, whether it can be used outside this function, I definitely can’t do it. Maybe just because I’m a beginner and obvious things for me are still too complicated.
def global urokb_in urokb_in = 1 with open ( 'users.txt' , 'r' ) as f: line = f.Rreadline () f.close () of open ( 'progress.txt' , '` `) as k: While true : global uroka_in lines = k.readline () if line == lines.rsstrip (): uroka_in = int (k.Riredline (). RSTRip ()) urooka_in + 1 uroka_str = str span> (uroka_in) urokb_str = str (urokb_in) lines.replace (uroka_str, urokb_str) k.close () break if not lines: k.close () urokb_in = 1 with open ( 'progress.txt' , 'a' a ') as j: : : : J.Write (Line) J.Write ( '\ n' ) J.Write ( str (urokb_in)) j.Write ( '\ n' span>) . J.Close () break if urokb_in == : educate__scr = Photoimage (File = 'e_scr_1.png' ) educate_label = label (root, imge = educate__scr) educate_label.place (x = 0 , y = 0 ) more experienced encoders tell me how to fix it. Syntaxerror: Name 'Urokb_in' Is used Prior to Global Declaration
question@mail.ru
·