Questions tagged [prettytable]

A simple Python library for easily displaying tabular data in a visually appealing ASCII table format.

PrettyTable is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables. It was inspired by the ASCII tables used in the PostgreSQL shell psql.

PrettyTable allows for selection of which columns are to be printed, independent alignment of columns (left or right justified or centred) and printing of “sub-tables” by specifying a row range.

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

155 questions
1
vote
1 answer

Issue with pretty tables in python

I'm currently working on a assignment for school, Im not asking for anyone to solve the problem for me, Im just trying to figure out what it is im doing wrong with pretty tables. Here is the code I have for the table itself import random from…
Kraken
  • 51
  • 5
1
vote
1 answer

Output pretty table to an html file?

I can't seem to get a clear cut answer on how to do this. I have a pretty table that I print to the terminal but what if I want to create an html file and print the table to that html file? How can this be done. This is my table that I have, how…
1
vote
3 answers

How to convert the PrettyTable output to a CSV file using Python

I am trying to convert the table created using the PrettyTable to CSV format using Python in an AWS lambda function. I am able to generate the CSV file, but the content inside the CSV file is not in CSV format. How can I fix if there is any issue in…
karthik
  • 417
  • 1
  • 7
  • 15
1
vote
2 answers

Dictionary to pretty table format

anyone can tell me how can I solve this please; I have this: dct = { "A": ['None', 'None', 'None'], "B" : ['None', 'None', 'None'] , "C": ['None', 'None', 'None'] , "D": ['None', 'None', 'None'] } and I am getting this: but, i want get this…
Elhabib
  • 141
  • 2
  • 10
1
vote
1 answer

How can I add a clickable web link in html table of the python script while dealing with prettytables

I am trying to add the web URL to the prettytable of python and generate this in an HTML table... As I am a Linux user, the terminal automatically detects the link present in the table but it is not in the case of HTML ... and also I am trying to…
ganesh tirumani
  • 35
  • 1
  • 10
1
vote
2 answers

How to access a cell ignoring the Title?

I;m trying to access an element of a cell from pretty table. When I tried that the title of the pretty table also comes as part of the output. is there a way to ignore it? from prettytable import PrettyTable table = PrettyTable(["Column 1", "Column…
S VIJAY
  • 55
  • 6
1
vote
1 answer

PrettyTable: "if len(self._rows) in (0, len(column)): AttributeError: 'str' object has no attribute '_rows'"

I'm trying to make a basic table by using the documentation. This is my version of the code: from prettytable import * table = PrettyTable table.add_column("", "Pokemon Name", ["Pikachu", "Squirtle", "Charmander"]) table.add_column("", "Type",…
user13821103
1
vote
2 answers

python dictionary and prettytable module

Need small help or at least point to right direction. I am writing small function that should print content of a dict in the prettytable format. Here is code example: head = ["HOSTNAME", "OS", "PROTOCOL"] data = { 'server1': ['ESXi', 'FC'], …
Z DZ
  • 13
  • 2
1
vote
1 answer

Python Prettytable Separating Each Table

I have a little question. How I can split the table if they have the same column name? This is the example: +----------------------------+ | AUDIO TRACKS | +----+----------+------------+ | ID | LangCode | LangName …
mark12345
  • 233
  • 1
  • 4
  • 10
1
vote
1 answer

I need return JSON as beauty table style

I have this code and works well import requests import xml.etree.ElementTree as ET import json def get_stock(sku): params = {'ItemId': sku} base_url = 'http://10.0.0.25/api/GetSku' response = requests.get(base_url, params=params) …
GMHS
  • 52
  • 4
1
vote
2 answers

Pretty table layout to make title inside the dividing lines

I have the following code for pretty table which goes like this: from prettytable import PrettyTable myTable = PrettyTable(["Student Name", "Class", "Section", "Percentage"]) myTable.title = 'Big Bang Theory' # Add…
Slartibartfast
  • 1,058
  • 4
  • 26
  • 60
1
vote
1 answer

pip install prettytable and got error "SyntaxError: invalid syntax"

MacOS Big Sur 11.2.3, python 2.7. I run sudo easy_install pip to install pip, then run pip install prettytable, finally I got errors below, anyone can help~ Traceback (most recent call last): File "/usr/local/bin/pip", line 11, in
1
vote
0 answers

PrettyTable is not printing table correctly in tkinter (python GUI)

I am trying to print table via PrettyTable library in python in my ScrolledText tkinter widget. here is the function snippet: global Scrolledtext1 Scrolledtext1 = ScrolledText(top, state="disable") def display_output(self,output_message): …
Aayush Shah
  • 584
  • 1
  • 8
  • 17
1
vote
1 answer

I am not able to see table borders when I create a prettytable

I am writing this simple code like so import prettytable # open csv file a = open("dash", 'r') # read the csv file a = a.readlines() # headers for table t = prettytable.PrettyTable(field_names=["Test", "Status"], title="Test Report", …
user3865019
  • 45
  • 1
  • 6
1
vote
1 answer

Python - PrettyTable, if text in one column is long is it possible to set it in new row?

my trouble is this: I would like to set text I have in tab separated format to a nice ASCII table. I can do that using prettytable and this is not my problem currently. The problem is that I have one column that have long text, and I would like for…
TMur
  • 13
  • 3
1 2
3
10 11