Bootstrap

从终端运行python程序

终端窗口运行.py程序 

  首先你要安装python,命令行输入 python 有python提示符 >>> 出现说明安装成功

  程序第一行应该是 #! python3  

#! python3
market_2nd={'ns':'green','ew':'red'} #ns南北向,ew东西向

def switchLights(stoplight):
    for key in stoplight.keys():
        if stoplight[key]=='green':
            stoplight[key]='yellow'
        elif stoplight[key]=='yellow':
            stoplight[key]='red'
        elif stoplight[key]=='red':
            stoplight[key]='green'
    assert 'red' in stoplight.values(),'交通灯都不是红色的'+str(stoplight)
;