用法:
print_exc(file=None)
從定時代碼打印回溯的助手。
典型用途:
t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except Exception: t.print_exc()
與標準回溯相比的優勢在於,將顯示編譯模板中的源代碼行。可選的
file
參數指示發送回溯的位置;它默認為sys.stderr
。
相關用法
- Python timeit()用法及代碼示例
- Python time.tzname()用法及代碼示例
- Python time.monotonic()用法及代碼示例
- Python time.tzset()用法及代碼示例
- Python time.asctime()用法及代碼示例
- Python time.clock()用法及代碼示例
- Python time ctime()用法及代碼示例
- Python time.daylight()用法及代碼示例
- Python time.perf_counter()用法及代碼示例
- Python time mktime()用法及代碼示例
- Python time.get_clock_info()用法及代碼示例
- Python time localtime()用法及代碼示例
- Python time sleep()用法及代碼示例
- Python time.strptime用法及代碼示例
- Python time.gmtime()用法及代碼示例
- Python time.strftime用法及代碼示例
- Python time.time()用法及代碼示例
- Python time.mktime()用法及代碼示例
- Python time.sleep()用法及代碼示例
- Python time.thread_time()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 timeit.Timer.print_exc。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。