Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you may not be able to execute some actions.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
flag = False def luoji(): flag = True luoji() print(flag)
False MicroPython v1.11-omv OpenMV v3.5.2 2019-12-17; OPENMV4-STM32H743 Type "help()" for more information.
加global 参数。
flag = False def luoji(): global flag flag = True luoji() print(flag)
参考: https://cn.bing.com/search?q=python+全局变量&qs=n&form=QBRE&sp=-1&pq=python+全局bian+liang&sc=8-19&sk=&cvid=212B6E3A90DD4FF9BA8FB8B9A5F9A590