Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2009-02-02 04:05:35
Size: 1004
Editor: ZoomQuiet
Comment:
Revision 4 as of 2009-12-25 07:14:54
Size: 937
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
[[TableOfContents]] <<TableOfContents>>
Line 6: Line 6:
[[Include(ZPyUGnav)]] <<Include(ZPyUGnav)>>
Line 9: Line 9:
= 自省: 前执行行数 = = 自省: 前执行行数 =
Line 43: Line 43:
创建 by -- ZoomQuiet [[[DateTime(2009-02-02T04:05:33Z)]]]
||<^>[[PageComment2]]||<^>[:/PageCommentData:PageCommentData]''||
创建 by -- ZoomQuiet [<<DateTime(2009-02-02T04:05:33Z)>>]

自省: 当前执行行数

题面

samson <[email protected]>
reply-to        [email protected]
to      python-cn`CPyUG`华蟒用户组 <[email protected]>
date    Sun, Feb 1, 2009 at 10:45
subject [CPyUG:77839] 怎样在程序中动态获得当前所执行的行号

smallfish:traceback()

smallfish <[email protected]>
reply-to        [email protected]
to      [email protected]
date    Sun, Feb 1, 2009 at 10:48

试试看

   1 import traceback
   2 print traceback.extract_stack()[0][1]

AlbertLee

http://blog.csdn.net/albertlee/archive/2004/11/10/175818.aspx


反馈

创建 by -- ZoomQuiet [2009-02-02 04:05:33]

MiscItems/2009-02-02 (last edited 2009-12-25 07:14:54 by localhost)