[Tutor] Help for Python

Alan Gauld alan.gauld at yahoo.co.uk
Fri Jun 23 20:20:13 EDT 2023


On 23/06/2023 11:44, majid butt wrote:
> 
> Dear Sir/Madam,
> 
> ...developed a database desktop application using Python and SQLite3.> At this point of time, I am able to retrieve data from database as a
list of tuples in Python.


Congratulations, that's usually the hardest bit (assuming
the data is correct!)

> What i need now is to attach a report template so that i can 
> give retrieved data to this template and generate a report 

OK, that'ds also pretty standard practice. Usually the report
lives in a text file someplace and you read it into your
program as needed.

> Could you please provide me the name of a third-party tool 
> (other than Excel & Pdf) from where i can design a template

Why nor PDF or Excel? These are excellent data formatting
tools and there is support for them from Python?

But there are many others. HTML is a common formatting tool
these days and you can style it with CSS.


>  and tell me the code to integrate this template with Python. 

You will need to create the template itself, no tool can
predict what you want to create. There are many templating tools
but frankly, for most cases, some basic HTML and CSS will suffice.

Pythons built in string formatting features should be sufficient
to insert your tuple data into the template string.

If HTML is not good enough you can use groff or LaTeX to produce
publishing quality output.

But ultimately, without sample data and details of what kind of
output you need it's impossible for us to give a complete
solution. And to be honest we try not to give complete solutions,
it's better to give pointers and let you find the full solution
yourself. That way you will be able to fix/extend it later.

If you can provide more details of the kind of template you
need, or explain why HTML/PDF etc can't be used then we'll be
happy to help with more suggestions.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos





More information about the Tutor mailing list