1.在js中{ }中的块级语句没有独立的作用域 var i = 5;for(; i < 8; i++){ console.log(i); } //输出 5 6 7 //全局设置的变量i在for条件中也能拿到 if(true){ var a = 5; } console.log(a); //输出5 //if条件中设置的变量a在全局中也能拿到 2.函数中是有作用域的,函数内的变量在函数外不能被访问 function f1(){ var x = 7; } f1(); console.log(type…
os模块为python解释器与操作系统交互的接口 os.popen() -------Open a pipe to or from command. The return value is an open file object connected to the pipe m=os.popen('dir') #执行系统命令列出当前目录下的文件目录,保存在变量m中 print m #<open file 'dir', mode 'r' at 0x00000000030F5540>m为保存在内…
Process 涉及模块:multiprocessing Process p = Process() p.start() p.join() from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid())) if __name__=='__main__': print('Parent pro…