When do I need to use the global keyword in python

前端 未结 4 406
攒了一身酷
攒了一身酷 2021-01-03 03:30

Okay, so I\'ve had this really annoying problem where a variable got set locally but then outside of that function reverted to it\'s old self (in this case None), but at the

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-03 03:52

    Variables you define in function are accessible only from this function's body.

提交回复
热议问题