Python/Python__works

실행 중인 메서드이름, 파일 이름

말하는감자 2020. 9. 24. 14:26

현재 실행 중인 파일 이름

import inspect

file_name = inspect.getfile(inspect.currentframe())

 

현재 실행 중인 메서드 이름

import sys

method_name = sys._getframe(0).f_code.co_name

'Python > Python__works' 카테고리의 다른 글

서버의 로그를 파이썬으로 읽어서 slack으로 전달하기  (0) 2020.09.24
datetime 활용하기  (0) 2020.09.24
fetchone() 분실 사건  (0) 2020.09.22
python slacker  (0) 2020.06.11
no module named mysqldb  (0) 2020.03.30