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
0
votes
1 answer

add several values into one cell of prettyTable

I have list like: [1, 2, ['a', 'b', 'c',], 3] How can I add a line in a table to insert values of sublist ['a', 'b', 'c',] in one cell of table. The values have to be under each other Is there any other libs to handle this use case if…
Vindict
  • 121
  • 3
0
votes
2 answers

Python prettytable custom columns

I'm trying to create a prettytable with 4 columns. The information I'm trying to insert per row are located in different python dictionary. I would assume the code below will work but i'm receiving the error below Exception: Row has incorrect number…
0
votes
0 answers

Send email having an object as body with win32com

I am trying to send an email using win32com and have an object as body, such as: outlook = win32com.Dispatch('outlook.application') mail = outlook.CreateItem(0) mail.To = 'receiver@email.com' mail.Subject = 'subject of email' mail.HtmlBody =…
0
votes
2 answers

sorting list of list containing datetime.date in increasing/decreasing order to create pretty table/csv file

I have a list of lists containing datetime object. table_of_list= [[name, email, address, details, date_last_contacted], [u'Jane Doe', u'jdoe@abc.com', u'sillybilly', u'dodo', datetime.date(2016, 11, 1)] [u'John Doe', u'jedoe@abc.com', u'123…
polyglot
  • 57
  • 11
0
votes
1 answer

Save and retrieve prettytable contents

I'm using prettytable module for pretty printing. I'd like to know how to save the prettytable instances. I know how to print it to a file but I want to save it somewhere, like pickling, if that's possible. And later, I'd like to access these…
kmario23
  • 57,311
  • 13
  • 161
  • 150
0
votes
1 answer

How would I format data in a PrettyTable?

I'm getting the text from the title and href attributes from the HTML. The code runs fine and I'm able to import it all into a PrettyTable fine. The problem that I face now is that there are some titles that I believe are too large for one of the…
Quintakov
  • 95
  • 1
  • 13
0
votes
2 answers

python prettytable module raise Could not determine delimiter error for valid csv file

I'm trying to use prettytable module to print out data from csv file. But it failed with the following exception Could not determine delimiter error for valid csv file >>> import prettytable >>> with file("/tmp/test.csv") as f: ... …
kjee
  • 359
  • 5
  • 19
0
votes
1 answer

Python table with multiple header lines

I need to create a table to display multiple sets of data that was collected with different conditions. This is what I need the table to look like: Config 1 Config 2 Test Data 1 Data 2 Data 1 Data 2 abc 123 123 123 …
BobJoe1803
  • 49
  • 1
  • 8
0
votes
1 answer

In a numpy record array, how can you order the elements based off a value in the record?

I have the following numpy record array. name module offset filter-2 filter_module 0x000020 filter-3 filter_module 0x000042 filter-1 filter_module 0x000014 I want to be able to detect which offset value is the…
GoldenEagle
  • 115
  • 1
  • 2
  • 15
0
votes
1 answer

How to update status on pretty table in python?

I am using python pretty table to print the status of each record on CLI. How to display the status updates on the CLI in the same table. Example: +--------------+---------+ | Jobs | Status | +--------------+---------+ | job1 | …
Gova
  • 235
  • 2
  • 3
  • 12
0
votes
1 answer

How to raw input to dictionary

I'm new to python, is there a way to modify this code to the point I can keyboard input movies and their rating and it appends to the row in the table? from prettytable import PrettyTable x = PrettyTable(["Moive Title", "Ratings"]) x.padding_width…
dmb
  • 35
  • 1
  • 1
  • 3
0
votes
1 answer

Python PrettyTable read csv file Exception: Row has incorrect number of values, (actual) 0!=3 (expected)

I have python running on my MacBook Air. I have a simple example I'm trying to read in a csv using prettytable for python: from prettytable import from_csv` fp = open("test.csv", "r")` pt = from_csv(fp)` fp.close() below is my csv…
wireddude
  • 1
  • 1
  • 1
0
votes
1 answer

Popup and the corrupted table showing in kivy

I'm a newbie in Python and Kivy as well, so I have some trouble. When I use kivy popup with showing the table (using "PrettyTable" module) I get broken view of this table. My python code: from kivy.app import App from kivy.uix.boxlayout…
0
votes
1 answer

Python PrettyTable printing table on same line

I'm using PrettyTable 'from_db_cursor' module to print nicely the responses I get from my sql requests. Everything works fine, my only problem is that for some of the queries i would like to print the table they are attached to one the same line…
Oscar
  • 231
  • 4
  • 17
0
votes
1 answer

Trouble using add_row with prettytable

I am trying to format an array using the prettytable library. Here is my code: from prettytable import PrettyTable arrayHR = [1,2,3,4,5,6,7,8,9,10] print ("arrayHR:", arrayHR) x = PrettyTable(["Heart Rate"]) for row in arrayHR: …
aag
  • 680
  • 2
  • 12
  • 33
1 2 3
10
11