Plumbum - Python Shell Combinators
Ever wished the wrist-handiness of shellscripts be put into a real programming language? Say helloto Plumbum Shell Combinators. Plumbum (Latin for lead,which was used to create pipes back in the day) is a small yet feature-richlibrary for shell script-like programs in Python. The motto of the libraryis "Never write shell scripts again", and thus itattempts to mimic the shell syntax ("shellcombinators") where it makes sense, while keeping it all pythonicand cross-platform.
Apart from shell-like syntax and handyshortcuts, the library provides local and remote command execution (over SSH),local and remote file-system paths, easy working-directory and environmentmanipulation, and a programmatic Command-Line Interface (CLI) applicationtoolkit. Now let's see some code!
This is only a teaser; the fulldocumentation can be found at Read the Docs
[size=10.5pt]Basics
CODE:
>>> from plumbum import local, FG, BG>>> from plumbum.cmd import ls, grep, wc, cat, head
>>> ls
LocalCommand(
>>> ls()
u'build.py\ndist\ndocs\nLICENSE\nplumbum\nREADME.rst\nsetup.py\ntests\ntodo.txt\n'
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-731270/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 用 Plumbum 開發 Python 命令列工具Python命令列
- Python Plumbum 簡介:用 Python 來寫指令碼Python指令碼
- Simple python reverse shellPython
- Python呼叫shell命令Python
- python和shell像嗎Python
- 如何呼叫python中的shell指令碼?Python指令碼
- 使用 Python 建立你自己的 Shell(下)Python
- python中shell執行知識點Python
- 使用 Python 建立你自己的 Shell (上)Python
- bpython:功能強大的Python shellPython
- 00.Python manage.py shell和 Python的分析Python
- python裡執行shell命令或cmd命令Python
- 用於golang的類python shell環境GolangPython
- python執行shell並獲取結果Python
- python:動態不刷螢幕輸出python/shell實現Python
- Python能代替shell嗎?有什麼特點?Python
- Python爬蟲教程-33-scrapy shell 的使用Python爬蟲
- Python3 - 用Shell萬用字元匹配字串Python字元字串
- C++/Php/Python語言執行shell命令C++PHPPython
- shell指令碼命令 執行python檔案&python命令列執行python程式碼指令碼Python命令列
- 或許你知道Python的shell,那jshell呢?PythonJS
- python 呼叫 shell ,獲取返回值和返回資訊Python
- 使用互動式 shell 來增強你的 PythonPython
- shell中呼叫shell的三種方式&並行shell並行
- Python踩坑之旅其一殺不死的Shell子程式Python
- 【Python】pyenv的版本控制及global、shell、local命令區別Python
- python學習1——1.3shell基本命令簡解Python
- impala-shell指令碼python環境缺少依賴包指令碼Python
- ShutIt:一個基於 Python 的 shell 自動化框架Python框架
- JSShell:一個基於python的互動式ShellJSPython
- [Shell] Shell 生成 HTML指令碼HTML指令碼
- Shell
- Shell程式設計-11-子Shell和Shell巢狀程式設計巢狀
- shell指令碼(6)-shell陣列指令碼陣列
- Shell基礎教程七:Shell字串字串
- Shell程式設計 --- Shell介紹程式設計
- 【shell 】 使用 shell 計算成績
- Shell入門——shell特性、變數變數