Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'string': 0.09; 'subject:skip:a 10': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'django': 0.11; '23,': 0.16; 'format:': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'sep': 0.31; 'file': 0.32; 'url:python': 0.33; 'framework': 0.33; 'subject:the': 0.34; 'display': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'url:mail': 0.40; 'how': 0.40; 'joel': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=nD4Lru7B/YbVHuZ0xHz9+GTP3UIrnWyPiBYI6kVt8gA=; b=jgqhsthH1CCIPQLy8Ll9lygcNtTKexBuT6OqcONtzVgU5zjS9Nh4Xxtn2l8zeNRnlQ nqWIyAaEGWZuwiJM1v3CUw+zLBCHRUV2A8VtIKEbAKbyMqYHA1OpTppSmj3SdvMjj3st 6+5eczYXp8yTtr2n3MjVRcPU3PrirbFO4jUDj7pAn4dYIfYcYwx7dS4Zy8irYYE6kzbd Idh9HO44XQWgAhHaJRsRZiE8wSUtuJ8jFoxA1r2qHPz2+8ihnIQEyAXWIpxs5Dv9bAKi 1seGwJ+yICkCqDIFM63Fxjr5ttwC8CBSWDkZDT32XoKSkyUcKM7QpeGGoANmEgk9bQz3 F1xA== MIME-Version: 1.0 X-Received: by 10.140.41.228 with SMTP id z91mr13574362qgz.99.1411483494243; Tue, 23 Sep 2014 07:44:54 -0700 (PDT) In-Reply-To: <54218121.8060902@gmail.com> References: <54218121.8060902@gmail.com> Date: Tue, 23 Sep 2014 10:44:54 -0400 Subject: Re: how to write a html to automatically display the dictionary? From: Joel Goldstick Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411483496 news.xs4all.nl 2878 [2001:888:2000:d::a6]:51361 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78216 On Tue, Sep 23, 2014 at 10: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 ? > Generally, you would use a framework like django or others, but you can make your html a string and use format: html = "... " % x['f1'] >
%d
> > > > > > > > > > >
> f1 > > f2 > > f3 >
> 1 > > 2 > > 3 >
> -- > https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com