Reputation: 374
I'd like to generate students report cards for the following students in this list
JAMES BOND GIRLS' SCHOOL. TERM III 2020 EXAMS
STREAM ADM POS NAME KCPE ENG KIS MAT BIO MKS PTS GRD
EAGLE 51 1 MARY 291 44 36 66 26 172 53 B-
EAGLE 50 1 CARO 304 23 20 60 27 130 53 B-
HAWK 49 3 RUTH 361 34 32 44 43 153 51 C+
EAGLE 48 4 PEREZE 317 33 23 32 55 143 48 C+
EAGLE 47 5 JANE 334 33 12 21 33 99 45 C
HAWK 46 6 JULIA 303 23 23 12 21 79 42 C
HAWK 56 7 CLARICE 353 22 11 11 23 67 41 C
HAWK 57 9 ESTHER 283 23 12 9 12 56 40 C
EAGLE 53 10 MELVIN 284 43 21 32 22 118 39 C
HAWK 52 10 MONICAH 286 32 33 23 21 109 39 C
A sample for the first student is here below
The best I could do is this here
name = 'MARY '
print(' JAMES BOND GIRLS SCHOOL')
print(' EXAMINATION RESULTS')
print(' NAME:',name )
print()
print()
print()
print()
Upvotes: 0
Views: 5303
Reputation: 2634
In order print Tabular Data in Terminal use tabulate module.
from tabulate import tabulate
# Create a header of the table data
table_heading = ["Heading 1", "Heading 2", "Heading 3"]
# a list of list containing inner list as rows of table
table_data = [["value x1", "value x2", "value x3"], ["value y1", "value y2", "value y3"], ["value z1", "value z2", "value z3"]]
# print data in tabular format in terminal
print(tabulate(table_data, headers=table_heading, tablefmt="fancy_grid"))
Output:
╒═════════════╤═════════════╤═════════════╕
│ Heading 1 │ Heading 2 │ Heading 3 │
╞═════════════╪═════════════╪═════════════╡
│ value x1 │ value x2 │ value x3 │
├─────────────┼─────────────┼─────────────┤
│ value y1 │ value y2 │ value y3 │
├─────────────┼─────────────┼─────────────┤
│ value z1 │ value z2 │ value z3 │
╘═════════════╧═════════════╧═════════════╛
There are different table format available. Choose according to your need. It can be used as a grid to suit your layout.
Reference of Module: https://pypi.org/project/tabulate/
Upvotes: 2
Reputation: 1729
Use reportlab
for generating tables on PDFs in Python. The endgame I think would be that only given, I worked on a system that did this.
Upvotes: 1
Reputation: 653
You should draft a fillable PDF form then use a package like pdfforms in order to use python to fill out the form.
Upvotes: 0