Re: how to write a html to automatically display the dictionary?

2014-09-24 Thread Jean-Michel Pichavant
- Original Message - From: luofeiyu elearn2...@gmail.com To: Joel Goldstick joel.goldst...@gmail.com, python-list@python.org Sent: Wednesday, 24 September, 2014 1:06:25 AM Subject: Re: how to write a html to automatically display the dictionary? how can i create the proper html

how to write a html to automatically display the dictionary?

2014-09-23 Thread luofeiyu
x={'f1':1,'f2':2,'f3':3} how can i create the following html file automatically with python to display x ? 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

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread Joel Goldstick
On Tue, Sep 23, 2014 at 10:18 AM, luofeiyu elearn2...@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

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread Tobiah
On 09/23/2014 07:18 AM, luofeiyu wrote: x={'f1':1,'f2':2,'f3':3} how can i create the following html file automatically with python to display x ? 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 def tablefy(values): print tr for

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread John Gordon
In mailman.14262.1411481932.18130.python-l...@python.org luofeiyu elearn2...@gmail.com writes: x={'f1':1,'f2':2,'f3':3} how can i create the following html file automatically with python to display x ? You might want to use something other than a dictionary, as the order isn't guaranteed.

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread Denis McMahon
On Tue, 23 Sep 2014 09:53:40 -0700, Tobiah wrote: On 09/23/2014 07:18 AM, luofeiyu wrote: how can i create the following html f3 /td /tr No tr here? td 1 ... td 3 /td tr What is the above tr doing there? /tr /table [code] Although your solution will produce valid html, it

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread Denis McMahon
On Tue, 23 Sep 2014 17:34:53 +, John Gordon wrote: In mailman.14262.1411481932.18130.python-l...@python.org luofeiyu elearn2...@gmail.com writes: x={'f1':1,'f2':2,'f3':3} how can i create the following html file automatically with python to display x ? You might want to use

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread luofeiyu
how can i create the proper html file with /Jinjia/2 or other temple? Joel Goldstick wrote: Generally, you would use a framework like django or others. -- https://mail.python.org/mailman/listinfo/python-list

Re: how to write a html to automatically display the dictionary?

2014-09-23 Thread Ned Batchelder
On 9/23/14 4:53 PM, Denis McMahon wrote: from string import * You aren't using any names from string, so you can skip this line. x={'f1':1,'f2':2,'f3':3} y = [ (a,x[a]) for a in x.keys() ] y.sort( cmp=lambda a,b: cmp(a[0],b[0]) ) This is more easily done as: y = sorted(x.items())