关于 getsourcelines 的输出请教,感谢!

2017-07-03 19:38:00 +08:00
 saximi
# -*- coding: utf-8 -*-
import inspect

import os

class Test(object):
"""Test Class """
def test(self):
self.fuc = lambda x:x

class Testone(Test):
pass

print( inspect.getsourcelines(Test)) #代码块,每行一个元素,组成数组


上面代码输出如下,请问数组中的 6 是表示什么?

(['class Test(object):\n', '\t"""Test Class """\n', '\tdef test(self):\n', '\t\tself.fuc = lambda x:x\n'], 6)
1269 次点击
所在节点    Python
1 条回复
Septembers
2017-07-04 04:32:07 +08:00
看文档啊

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/372755

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX