大家好,我是新来的python语言,我选择了学python难学的方法来学习它,并更好地理解我......我被难倒在练习25,当我们导入代码直接进入终端学习python的难题,练习25
>>> import ex25
>>> sentence = "All good things come to those who wait."
>>> words = ex25.break_words(sentence)
然后我得到一个属性错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'break_words'
我使用 窗口Python 2.7版7,请帮助..... http://learnpythonthehardway.org/book/ex25.html
那么你在'ex25.py'中定义了什么呢? –
'进口ex25; dir(ex25)'会告诉你模块提供了哪些功能。 –
可能是ex25中的错字,或者您可能没有复制/粘贴网页中的所有源代码。 – gatto