3
Q
Pythonは
A
答えて
8
os.system
を使用する場合、使用するシェルは/bin/sh
です。多くのオペレーティングシステムでは、/bin/sh
はbash
ではありません。使用しているリダイレクト&>
はPOSIXによって定義されておらず、dash
のようないくつかのシェルでは動作しません。これはDebian上の/bin/sh
とその派生物の多くです。次のように正しく出力を抑制する必要があります:
os.system('sudo ifdown wlan0 > /dev/null 2>&1')
関連する問題
- 1. は、PythonはPythonで
- 2. Pythonは - Pythonの
- 3. Pythonは:Pythonのに
- 4. は、Python 3.5でPythonの
- 5. は、Python 3のpython 3
- 6. Pythonスクリプトは、Python 2.7インタプリタ
- 7. Pythonのstring.join()はPythonで
- 8. のpython、状態はPythonでは
- 9. は、Python
- 10. Pythonは
- 11. Pythonは
- 12. Pythonは:
- 13. は、Python
- 14. は、Python
- 15. ()はPython
- 16. は、Python
- 17. は、Python
- 18. は、Python
- 19. Pythonは -
- 20. は、Python
- 21. は、Python
- 22. は、Python
- 23. Pythonは...
- 24. は、Python
- 25. は、Python
- 26. は、Python
- 27. は、Python
- 28. は、Python
- 29. Pythonは
- 30. Pythonは:
ここで説明したように 'サブプロセス 'を使用できますか? http://stackoverflow.com/questions/11269575/how-to-hide-output-of-subprocess-in-python-2-7 –