2011-08-30 73 views
3
def myfunc(): 
    """ My docstring """ 
    print "hello" 

help(myfunc) 

我得到python docstrings不工作?

'more' is not recognized as an internal or external command, 
operable program or batch file. 

64位Windows 7,Python 2.6中

+3

爲什麼你沒有[更多](http://www.computerhope.com/morehlp.htm)? – Keith

+1

這不是一個Python問題。這只是一個Window問題。 –

+0

您可以指定如何從命令行執行腳本嗎? –

回答

2

Python's help() function嘗試,你的情況,執行more命令。它應該是這個樣子,安裝更多的時候:

>>> help(myfunc) 
Help on function myfunc in module __main__: 

myfunc() 
    My docstring 

但你也可以做

>>> print myfunc.__doc__ 
My docstring 

閱讀文檔字符串。

1

我認爲問題不在於你的Windows操作系統沒有more但Windows 7的UAC(用戶訪問控制)中運行你的命令行窗口中user mode代替admin mode.爲了解決這個問題,運行cmd以管理員身份然後從該窗口運行python。這應該照顧它。我假設你已經找到more程序C:\Windows\System32\more.com