Python模組之"prettytable"

來源:互聯網
上載者:User

標籤:

1、查看系統是否已經安裝prettytable模組

        

2、下載prettytable模組

        登陸:https://pypi.python.org/pypi/PrettyTable

        

3、安裝PrettyTable模組

[[email protected] ~]# wget https://pypi.python.org/packages/source/P/PrettyTable/prettytable-0.7.2.tar.gz[[email protected] ~]# tar -zxvf prettytable-0.7.2.tar.gz[[email protected] prettytable-0.7.2]# python setup.py buildrunning buildrunning build_pycreating buildcreating build/libcopying prettytable.py -> build/lib[[email protected] prettytable-0.7.2]# python setup.py install   # 安裝prettytablerunning installrunning bdist_eggrunning egg_infowriting prettytable.egg-info/PKG-INFOwriting top-level names to prettytable.egg-info/top_level.txtwriting dependency_links to prettytable.egg-info/dependency_links.txtreading manifest file ‘prettytable.egg-info/SOURCES.txt‘reading manifest template ‘MANIFEST.in‘writing manifest file ‘prettytable.egg-info/SOURCES.txt‘installing library code to build/bdist.linux-x86_64/eggrunning install_librunning build_pycreating build/bdist.linux-x86_64creating build/bdist.linux-x86_64/eggcopying build/lib/prettytable.py -> build/bdist.linux-x86_64/eggbyte-compiling build/bdist.linux-x86_64/egg/prettytable.py to prettytable.pyccreating build/bdist.linux-x86_64/egg/EGG-INFOcopying prettytable.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFOcopying prettytable.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFOcopying prettytable.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFOcopying prettytable.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFOzip_safe flag not set; analyzing archive contents...creating distcreating ‘dist/prettytable-0.7.2-py2.6.egg‘ and adding ‘build/bdist.linux-x86_64/egg‘ to itremoving ‘build/bdist.linux-x86_64/egg‘ (and everything under it)Processing prettytable-0.7.2-py2.6.eggcreating /usr/lib/python2.6/site-packages/prettytable-0.7.2-py2.6.eggExtracting prettytable-0.7.2-py2.6.egg to /usr/lib/python2.6/site-packagesAdding prettytable 0.7.2 to easy-install.pth fileInstalled /usr/lib/python2.6/site-packages/prettytable-0.7.2-py2.6.eggProcessing dependencies for prettytable==0.7.2Finished processing dependencies for prettytable==0.7.2

4、測試pretty模組

>>> import tab>>> from prettytable import PrettyTable>>> row = PrettyTable()>>> row.field_names = ["Name", "Age","Country","City"]>>> row.add_row([‘shaw‘,‘23‘,‘China‘,‘Shanghai‘])>>> row.add_row([‘charle‘,‘29‘,‘China‘,‘Xuzhou‘])>>> row.add_row([‘jack‘,‘32‘,‘United States‘,‘Washington‘])>>> print row+--------+-----+---------------+------------+|  Name  | Age |    Country    |    City    |+--------+-----+---------------+------------+|  shaw  |  23 |     China     |  Shanghai  || charle |  29 |     China     |   Xuzhou   ||  jack  |  32 | United States | Washington |+--------+-----+---------------+------------+


Python模組之"prettytable"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.