python获取debug模式,给debug运行添加参数,经过测试,可以通过下面代码来判断当前是否debug运行:
importos
try:
oracle_vars =dict((a,b)fora,binos.environ.items()ifa.find('IPYTHONENABLE') >=0)
iflen(oracle_vars) >0:
print(oracle_vars)
print(os.environ['IPYTHONENABLE'])
print(os.environ['IDE_PROJECT_ROOTS'])
print(os.environ['PYTHONDONTWRITEBYTECODE'])
exceptZeroDivisionErrorase:
print(e.message)