Help with Python UnboundLocalError: local variable referenced before assignment

后端 未结 4 1798
Happy的楠姐
Happy的楠姐 2021-01-14 23:53

I have post the similar question before,however,I think I may have misinterpreted my question,so may I just post my origin code here,and looking for someone can help me,I am

4条回答
  •  情书的邮戳
    2021-01-15 00:37

    Put an additional global statement containing all your globals after each def statement. Otherwise, all globals are transformed into locals within your def without it.

    def update_v(n,vs,ve,ms,me,dt,fs,fe):
        global vs, ve, ...  
    

提交回复
热议问题