Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78216 > unrolled thread
| Started by | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| First post | 2014-09-23 10:44 -0400 |
| Last post | 2014-09-23 10:44 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: how to write a html to automatically display the dictionary? Joel Goldstick <joel.goldstick@gmail.com> - 2014-09-23 10:44 -0400
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2014-09-23 10:44 -0400 |
| Subject | Re: how to write a html to automatically display the dictionary? |
| Message-ID | <mailman.14264.1411483496.18130.python-list@python.org> |
On Tue, Sep 23, 2014 at 10:18 AM, luofeiyu <elearn2014@gmail.com> wrote:
> x={'f1':1,'f2':2,'f3':3}
> how can i create the following html file automatically with python to
> display x ?
>
Generally, you would use a framework like django or others, but you
can make your html a string and use format:
html = "<table><tr><td>%d</td>... " % x['f1']
> <table border=1>
> <tr>
> <td>
> f1
> </td>
> <td>
> f2
> </td>
> <td>
> f3
> </td>
> </tr>
> <td>
> 1
> </td>
> <td>
> 2
> </td>
> <td>
> 3
> </td>
> <tr>
> </tr>
> </table>
> --
> https://mail.python.org/mailman/listinfo/python-list
--
Joel Goldstick
http://joelgoldstick.com
Back to top | Article view | comp.lang.python
csiph-web