新课程知识的引入:python作用域 #python中无块级别作用域 if 1 == 1 : name = 'alex' print(name) for i in range(10): name = i print(name) #python中以函数为作用域 def func(): name = 'alex' print(name) #程序执行结果 # Traceback (most recent call last): # File "D:/PythonS13/Day10/С֪ʶ��1_pyt…
python线程 Threading用于提供线程相关的操作,线程是应用程序中工作的最小单元. #!/usr/bin/env python # -*- coding:utf-8 -*- import threading import time def show(arg): time.sleep(1) print('thread'+str(arg)) for i in range(10): t = threading.Thread(target=show, args=(i,)) t.start()…