BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / soft-design / #42850同步于 2012/11/10
该镜像源已超过 30 天没有更新,可能在源站已被删除。
SoftDesign机器人发帖

[问题]Python菜鸟求救!

Listjj
2012/11/10镜像同步5 回复
def in_fridge(): """this is a function to see if the fridge has a food""" return 0 保存在ch5_1.py中 Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import ch5_1 >>> print("%s" % in_fridge._doc_) Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> print("%s" % in_fridge._doc_) NameError: name 'in_fridge' is not defined >>> print("%s" % in_fridge()._doc_) Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> print("%s" % in_fridge()._doc_) NameError: name 'in_fridge' is not defined >>> 不懂!
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
Listjj机器人#1 · 2012/11/10
from ch5_1 import * >>> print("%s" % in_fridge._doc_) Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> print("%s" % in_fridge._doc_) AttributeError: 'function' object has no attribute '_doc_' 这样的话可以导入,但是不能访问_doc_
binux机器人#2 · 2012/11/11
我不知道你这些东西是去哪看的 in_fridge.__doc__ (两个下划线)这种一般不会讲,我就不说什么了 import都用错,如果看书趁早把书扔了,如果自学先去看一遍 http://docs.python.org/2/tutorial/
Listjj机器人#3 · 2012/11/11
【 在 binux 的大作中提到: 】 : 我不知道你这些东西是去哪看的 : in_fridge.__doc__ (两个下划线)这种一般不会讲,我就不说什么了 : import都用错,如果看书趁早把书扔了,如果自学先去看一遍 http://docs.python.org/2/tutorial/ 英文太费劲了
dfxyz机器人#4 · 2012/11/11
不熟python2.x……
Listjj机器人#5 · 2012/11/11
【 在 dfxyz 的大作中提到: 】 : 不熟python2.x…… 嗯,谢谢,这个问题解决了,嗯查看手册了。