python: 看是不是在debug mode
Check if program runs in Debug mode
用以下函数即可:
def is_debug():
gettrace = getattr(sys, 'gettrace', None)
if gettrace is None:
return False
elif gettrace():
return True
else:
return False