Download here: http://gg.gg/vxf96
*Conda install linux-64 v0.7.2; win-32 v0.7.2; noarch v2.1.0; osx-64 v0.7.2; win-64 v0.7.2; To install this package with conda run one of the following: conda install -c conda-forge prettytable.
*Python module for creating simple ASCII tables. This module is available on PyPI, and has been packaged for several Linux/Unix platforms (Debian, FreeBSD, Fedora, Suse.). If available, cjkwrap library is used instead of textwrap, for a better wrapping of CJK text. If available, wcwidth library is used for a better rendering (basic emoji support).
Arch Linux Community aarch64 Official python-prettytable-0.7.2-14-any.pkg.tar.xz: A simple Python library for easily displaying tabular data: Arch Linux Community x8664 Official python-prettytable-0.7.2-14-any.pkg.tar.zst.Latest version
Released:
module for creating simple ASCII tablesProject description
Python module for creating simple ASCII tablesAvailability
This module is available on PyPI, and has been packaged for several Linux/Unix platforms(Debian,FreeBSD, Fedora, Suse..).Dependencies
If available, cjkwrap library is used instead of textwrap, for a better wrapping of CJK text.
If available, wcwidth library is used for a better rendering (basic emoji support).DocumentationForks
*latextable is a fork of texttable that provide a LaTeX backend.Release historyRelease notifications | RSS feed
1.6.3
1.6.2
1.6.1
1.6.0
1.5.0
1.4.0
1.3.1
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.0 Bahamian rhapsody deluxe for mac.
0.9.1
0.9.0
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0 Download files
Download the file for your platform. If you’re not sure which to choose, learn more about installing packages.Files for texttable, version 1.6.3Filename, sizeFile typePython versionUpload dateHashesFilename, size texttable-1.6.3-py2.py3-none-any.whl (10.7 kB) File type Wheel Python version py2.py3 Upload dateHashesFilename, size texttable-1.6.3.tar.gz (14.5 kB) File type Source Python version None Upload dateHashesCloseHashes for texttable-1.6.3-py2.py3-none-any.whl Hashes for texttable-1.6.3-py2.py3-none-any.whlAlgorithmHash digestSHA256f802f2ef8459058736264210f716c757cbf85007a30886d8541aa8c3404f1ddaMD58e2633f129a835cb0cfc97d73b520bf4BLAKE2-25606f546201c428aebe0eecfa83df66bf3e6caa29659dbac5a56ddfd83cae0d4a4CloseHashes for texttable-1.6.3.tar.gz Hashes for texttable-1.6.3.tar.gzAlgorithmHash digestSHA256ce0faf21aa77d806bbff22b107cc22cce68dc9438f97a2df32c93e9afa4ce436MD568e6b31d36f5c20221da7d5db3eca772BLAKE2-256f5be716342325d6d6e05608e3a10e15f192f3723e454a25ce14bc9b9d1332772
last modified July 6, 2020
PrettyTable tutorial shows how to use Python PrettyTable module to generate ASCII tables in Python.In this tutorial we use the PTable module, which is a fork of the original PrettyTablelibrary. PrettyTable
PrettyTable is a Python library for generating simple ASCII tables.It was inspired by the ASCII tables used in the PostgreSQL shell psql.We can control many aspects of a table, such as the width of the column padding, the alignment of text, or the table border. We can sort data.
We can also choose which columns and rows are going to be displayed in the final output. PrettyTable can read data from CSV, HTML, or database cursor and output data in ASCII or HTML.PrettyTable installation
We use the pip3 tool to install PrettyTable.Generating PrettyTable
A table can be created with add_row() or add_column() methods.create_by_row.py
The example creates a PrettyTable with the add_row() method.
From the module, we import PrettyTable.
We set the header names.
The rows are added to the table with add_row().
In the end, we print the table to the console.
This is the output.
In the next example, we create the same table with the add_column()method.
The column name is the first parameter of the add_column()method.PrettyTable deleting rows
With del_row() it is possible to delete a specific row.The method takes the index of the row to be deleted. Note that indexingstart from zero.delete_rows.py
In the example, we delete last four rows.
The first three rows are left in the output.PrettyTable clearing data
The clear_rows() method deletes all rows from the table but keeps the current column names. The clear() method clears both rows and column names.
The example clears all rows from the table.
This is the output of the example. The header of the table is not deleted.PrettyTable generation from CSV
The from_csv() method can be used to generate a PrettyTable from CSV data.data.csv
The data.csv contains data separated by comma character. Note that the first row consists of table column names.
The example reads data from data.csv and generates a PrettyTablewith from_csv() from it.PrettyTable generation from database cursor
The from_db_cursor() method generates PrettyTable from a database cursor.cities.sql
This is an SQL script to create a Cities table in the SQLite database.
We read the cities.sql script which generates the database table.
In the code example, we connect to the data.db database and select all data from the Cities table. We generate a PrettyTablefrom the cursor using the from_db_cursor() method.PrettyTable generation from HTML
The from_html() generates a list of PrettyTables from a string of HTML code. Each <table> in the HTML becomes one PrettyTable object.The from_html_one() generates a PrettyTable from a string of HTML code which contains only a single <table>.
In the example, we use this HTML file.read_from_html.py
The example reads data from the data.html file and generates a PrettyTable with the from_html_one() method.Sorting data
With the sortby property, we specify which columnis going to be sorted. The reversesort property controls the direction of sorting (ascending vs descending).
In the example, we sort data of the table.
First, we sort the data by population in ascending order.
Then we sort data by city name in descendig order.
This is the output.Data alignment
The align property controls alignment of fields.Its possible values are l, c, and r.alignment.py
The code example aligns data in the table columns.
We align fields in the ’City name’ column to the left.Install Prettytable Python Anaconda
We align fields in the ’Area’ and ’Annual Rainfall’ to the right.
This is the output.HTML outputInstall Prettytable Python Online
The coma 2: vicious sisters crack. The get_html_string() generates HTML output from a PrettyTable.
The example prints the data in an HTML table to the console.The get_string method
The get_string() method returns the string representation of a table in current state. It has several options that control howthe table is shown.Showing title
With the title parameter, we can include a table title inthe output.table_title.py
The example creates a PrettyTable with a title.
This is the output.Selecting column
With the fields option we can select columns which are going to be displayed.
In the example, we only display ’City name’ and ’Population’ columns.Selecting rows
With the start and end parameters, we can select which rows to display in the output.select_rows.py
In the example, we only include three rows in the output.
This is the output of the example.
In this tutorial, we have used the PrettyTable library to generate ASCII tables in Python.
Visit Python tutorial or list all Python tutorials.
Download here: http://gg.gg/vxf96

https://diarynote-jp.indered.space

コメント

お気に入り日記の更新

テーマ別日記一覧

まだテーマがありません

この日記について

日記内を検索