Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Python 2.7.3 では、次のような定義の名前を取得できます。
def Newname(self): print name_of_def > "Newname"
どうも、
パックス
import sys def newname(): print sys._getframe().f_code.co_name newname()
使用する__name__
__name__
def Newname(): return 0 print Newname.__name__