×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Super easy in Python. If you're using the OPS Python, you can use
prettytable: [1]https://pypi.python.org/pypi/PrettyTable

To install, just run from a PASE shell: pip3 install ptable

#!/usr/bin/env python3

import ibm_db_dbi as db2
from prettytable import from_db_cursor

query = "select * from qiws.qcustcdt"

conn = db2.connect()
cur = conn.cursor()
cur.execute(query)

table = from_db_cursor(cur)

with open("file.html", "w") as file:
file.write("""<!DOCTYPE HTML>
<html lang="en-US">
<head>
<title>Table to HTML</title>
<head>
<body>
{}
</body>
</html>""".format(table.get_html_string()))

References

Visible links
1. https://pypi.python.org/pypi/PrettyTable

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.