2006年01月17日 星期二 16:46
通过dir我们可以返回一个类的全部函数,如果我想得到某个函数的doc串,该如何操作呢?因为dir得到的函数名称是字符串的,我们不能直接通过__doc__得到。也就是说,代码中的XX部分该如何填写? 代码如下: ---------------- class Fmt: def __init__ (self): pass def TotalPlugin (self): """返回所有插件(以G_开头的函数)""" l = dir(self) Plugin = [] for item in l: if len(item)>2: if item[:2]=="G_": temp = [] temp.append(item) temp.append(XX.__doc__) Plugin.append(temp) return Plugin -- My Blog >> http://leejd.cndev.org My QQ >> 9847243 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060117/e04fd211/attachment.htm
2006年01月17日 星期二 16:54
> temp.append(XX.__doc__) temp.append(getattr(self, item).__doc__) ----- Original Message ----- From: Gerald Lee To: python-chinese at lists.python.cn ; python-cn at googlegroups.com Sent: Tuesday, January 17, 2006 4:46 PM Subject: [python-chinese] 获取函数的__doc__ 通过dir我们可以返回一个类的全部函数,如果我想得到某个函数的doc串,该如何操作呢?因为dir得到的函数名称是字符串的,我们不能直接通过__doc__得到。也就是说,代码中的XX部分该如何填写? 代码如下: ---------------- class Fmt: def __init__ (self): pass def TotalPlugin (self): """返回所有插件(以G_开头的函数)""" l = dir(self) Plugin = [] for item in l: if len(item)>2: if item[:2]=="G_": temp = [] temp.append(item) temp.append(XX.__doc__) Plugin.append(temp) return Plugin -- My Blog >> http://leejd.cndev.org My QQ >> 9847243 ------------------------------------------------------------------------------ _______________________________________________ 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/20060117/8ae34a1e/attachment.html
2006年01月17日 星期二 18:44
I try to install python2.4.2 on solaris. After "./configure" "make" everything is ok. When i try to "make install",an error accured! --------------------------------------------------------------------------------------------- PYTHONPATH=/usr/local/lib/python2.4 ./python -Wi -tt /usr/local/lib/python2.4/compileall.py -d /usr/local/lib/python2.4 -f -x 'badsyntax|site-packages' /usr/local/lib/python2.4 ld.so.1: python: fatal: libstdc++.so.5: open failed: No such file or directory *** Error code 137 make: Fatal error: Command failed for target `libinstall' --------------------------------------------------------------------------------------------- Why? What should I do? 3ks!
2006年01月17日 星期二 18:58
貌似你的libstdc++.so.5找不到了 去/usr/lib 下面找找 有没有 libstdc++.so.5.0.X 之类的文件 如果有的话就 ln -s 到libstdc++.so.5 没有的话就安装一个libstdc++5吧 Yaou xinguoyao wrote: >I try to install python2.4.2 on solaris. >After "./configure" "make" everything is ok. >When i try to "make install",an error accured! >--------------------------------------------------------------------------------------------- >PYTHONPATH=/usr/local/lib/python2.4 ./python -Wi -tt /usr/local/lib/python2.4/compileall.py -d /usr/local/lib/python2.4 -f -x 'badsyntax|site-packages' /usr/local/lib/python2.4 >ld.so.1: python: fatal: libstdc++.so.5: open failed: No such file or directory >*** Error code 137 >make: Fatal error: Command failed for target `libinstall' >--------------------------------------------------------------------------------------------- >Why? >What should I do? >3ks! > > >_______________________________________________ >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 > > >
Zeuux © 2025
京ICP备05028076号