1. What is BeautifulTable?
This package provides BeautifulTable Class for easily printing tabular data in a visually appealing format to a terminal.
Features included but not limited to :
- Full customization of the look and the feel of the table
- Build the table as you wish, by adding rows, or by columns or even mixing both these approaches.
- Full support for colors using ANSI sequences or any library of your choice. It just works.
- Plenty of predefined styles for multiple use cases and option to create custome ones.
- Support for Unicode characters.
- Supports streaming table when data is slow to retrieve.
2. How to use
Step 1 : Import libraries and make objects
from beautifultable import BeautifulTable
table = BeautifulTable(maxwidth = 130)
You can control maxwidth with 'maxwidth' parameter.
Step 2 : Add columns and rows
You can add rows by using append_row method until you want to end.
table.column_headers = laptops.header
# Find laptops under 500 euros
for laptop in laptops.find_laptop_within('Price_euros', 200):
table.append_row(laptop)
print(table)
Step 3 : Print the result
'Language > Python' 카테고리의 다른 글
[folium] Visualization Map on Python (0) | 2022.09.18 |
---|---|
[heapq] Implementing Binary Heap in Python (0) | 2022.09.14 |
[queue] Implementing Priority Queue in Python (0) | 2022.09.14 |
[Syntax] Exception (0) | 2022.09.14 |
[beautifulsoup] Web Scraping (0) | 2022.09.13 |