2006年02月08日 星期三 13:21
比如,对于test能够得到所属类Test Python 2.4.2 (#1, Nov 12 2005, 10:57:47) [GCC 4.0.3 20051006 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class Test: ... a = 1 ... >>> test = Test() >>> test <__main__.Test instance at 0xb7b812ac> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060208/8963d1d1/attachment.htm
2006年02月08日 星期三 13:38
在 06-2-8,Peng Xiaoyu<peng.xiaoyu at gmail.com> 写道: > 比如,对于test能够得到所属类Test > > Python 2.4.2 (#1, Nov 12 2005, 10:57:47) > [GCC 4.0.3 20051006 (prerelease)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> class Test: > ... a = 1 > ... > >>> test = Test() > >>> test > <__main__.Test instance at 0xb7b812ac> > > test.__class__.__name__ -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年02月08日 星期三 14:43
谢谢了,刚学python :) 为什么dir(Test)看不到__name__? 这一部分属于那个部分,在library reference里找了半天,难道不是属于buildin objects一类的? 在06-2-8,limodou <limodou at gmail.com> 写道: > > 在 06-2-8,Peng Xiaoyu<peng.xiaoyu at gmail.com> 写道: > > 比如,对于test能够得到所属类Test > > > > Python 2.4.2 (#1, Nov 12 2005, 10:57:47) > > [GCC 4.0.3 20051006 (prerelease)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> class Test: > > ... a = 1 > > ... > > >>> test = Test() > > >>> test > > <__main__.Test instance at 0xb7b812ac> > > > > > test.__class__.__name__ > > > -- > I like python! > My Blog: http://www.donews.net/limodou > NewEdit Maillist: http://groups.google.com/group/NewEdit > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060208/15072ede/attachment.htm
2006年02月08日 星期三 14:52
在 06-2-8,Peng Xiaoyu<peng.xiaoyu at gmail.com> 写道: > 谢谢了,刚学python :) > > 为什么dir(Test)看不到__name__? > 这一部分属于那个部分,在library reference里找了半天,难道不是属于buildin objects一类的? > 有些东西是不让dir看到的。在 Python Library Reference 中的 2.3.11 Special Attributes 有关于这部分东西的说明。 -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit
Zeuux © 2025
京ICP备05028076号