python 一些有趣的模組

來源:互聯網
上載者:User

標籤:python   sh   

  最近壓力有點大,沒什麼樂趣,就找幾個有意思的python庫娛樂一下自己(當我裝X了,放過我吧) 

一、progressbar 提供了一個控制台進度條工具

   1、安裝

pip install progressbar

   2、樣本:

#!/usr/bin/env python#coding:utf8from __future__ import divisionimport sys,timefrom progressbar import *total = 100pbar = ProgressBar().start()for i in range(1,100):    pbar.update(int((i/(total-1))*100))    time.sleep(0.01)pbar.finish()


二、sh庫提供了Shell命令的封裝,如果你很熟悉Shell命令那麼一定會喜歡上它的,以前都用了commands了,今天當看這個庫,那叫一個酸爽~,只要系統中的命令都可以引用(限*nux)(-_-)

 1、安裝 

pip install sh

 2、樣本

In [27]: from sh import grepIn [28]: grep("root", "/etc/passwd")Out[28]: root:x:0:0:root:/root:/bin/bashoperator:x:11:0:operator:/root:/sbin/nologin

三、colorama 彩色控制台輸出

 1、安裝

pip install colorama

 2、樣本

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/71/60/wKiom1XMmRvyOAHxAABwkwDbaP8808.jpg" title="QQ20150813211756.png" alt="wKiom1XMmRvyOAHxAABwkwDbaP8808.jpg" />

對於色彩控,應該有用吧!


ps :就到這裡吧,有時間再寫有些像樣子,以上就當娛樂自己了!!!

本文出自 “和風細雨” 部落格,請務必保留此出處http://essun.blog.51cto.com/721033/1684475

python 一些有趣的模組

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.