python 디버그: line 번호 찍기
Python 2008. 8. 1. 01:01파이썬에서 이런 방법을 쓸때 프린트하는 라인번호를 함께 찍는 간단한 방법을 메모해 둔다.
def lineno():
"""
이 함수를 호출한 곳의 라인번호를 리턴한다.
"""
return inspect.getlineno(inspect.getouterframes(inspect.currentframe())[-1][0])
print lineno(), "message"
'Python' 카테고리의 다른 글
Python String/Unicode translate() 함수 (0) | 2008.09.29 |
---|---|
python 키 입력 받는 함수; input, raw_input, getpass (0) | 2008.07.13 |
python object의 멤버 attribute를 런타임에 생성하기 (0) | 2008.03.20 |
Google pagerank를 알아내는 python코드 (1) | 2008.01.26 |
Python Built-in 가지고 놀기 (0) | 2007.08.30 |