2015-09-01 96 views
-2

我試着使用Python子來ping服務器,但出現以下錯誤 -沒有屬性getstatusoutput

>>> import subprocess as sp 
>>> sp.getstatusoutput('ping 127.0.0.1') 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
AttributeError: 'module' object has no attribute 'getstatusoutput' 
+0

嗯,是的,['subprocess'](https://docs.python.org/2/library/subprocess.html)沒有該屬性。你在期待什麼? – jonrsharpe

回答