Published On: 1970-01-01|Last Updated: 1970-01-01|Categories: Uncategorized|
>>> import sys
>>> for i in range(-1, 100):
print '%d: %s' % (i, sys._getframe(i).f_code.co_filename, )
-1: <pyshell#2>
0: <pyshell#2>
1: C:\Python25\lib\idlelib\run.py
2: C:\Python25\lib\idlelib\run.py
3: <string>
Traceback (most recent call last):
File "<pyshell#2>", line 2, in <module>
print '%d: %s' % (i, sys._getframe(i).f_code.co_filename, )
ValueError: call stack is not deep enough

関連