Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'thats': 0.07; 'python': 0.09; 'script,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'template': 0.11; 'marker': 0.16; 'script?': 0.16; 'substituted': 0.16; 'templating': 0.16; 'wrote:': 0.17; 'url:moin': 0.17; 'load': 0.19; 'sort': 0.21; 'bit': 0.21; 'parse': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'url:wiki': 0.26; 'am,': 0.27; '(maybe': 0.29; 'cgi': 0.29; 'stuff': 0.30; 'gets': 0.32; 'url:python': 0.32; 'file': 0.32; 'print': 0.32; 'another': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'michael': 0.36; 'but': 0.36; 'url:org': 0.36; 'data.': 0.36; 'thank': 0.36; 'xml': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'instead': 0.39; 'system.': 0.39; 'skip:" 10': 0.40; 'your': 0.60; 'kind': 0.61; '8bit%:100': 0.70; '8bit%:92': 0.70; '2013': 0.84; 'liens': 0.84 X-Received: by 10.49.1.43 with SMTP id 11mr2111826qej.29.1362417758251; Mon, 04 Mar 2013 09:22:38 -0800 (PST) Newsgroups: comp.lang.python Date: Mon, 4 Mar 2013 09:22:38 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.68.127.128; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4 References: <1a5a68d8-a97e-4069-a860-c7737dd5a503@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.68.127.128 MIME-Version: 1.0 Subject: Re: Embedding a for inside an html template for substitution From: Ferrous Cranus To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org 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: , Message-ID: Lines: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362417767 news.xs4all.nl 6971 [2001:888:2000:d::a6]:35755 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40469 =CE=A4=CE=B7 =CE=94=CE=B5=CF=85=CF=84=CE=AD=CF=81=CE=B1, 4 =CE=9C=CE=B1=CF= =81=CF=84=CE=AF=CE=BF=CF=85 2013 5:59:34 =CE=BC.=CE=BC. UTC+2, =CE=BF =CF= =87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Michael Torrie =CE=AD=CE=B3=CF=81= =CE=B1=CF=88=CE=B5: > On 03/04/2013 08:14 AM, Ferrous Cranus wrote: >=20 > > Instead of writing the above html data inside my html template how >=20 > > would i write it with a for that then will be substituted by the >=20 > > python script? >=20 >=20 >=20 > What templating system are you using? Django's? >=20 >=20 >=20 > > can you please write an example for me that user "files.html" and >=20 > > gets populates by "files.py" ? >=20 >=20 >=20 > If you're using a CGI script, just use a normal python for loop and >=20 > print out the stuff you want using this kind of notation: >=20 >=20 >=20 > for x in xrange(4): >=20 > print "{0}".format(x) >=20 >=20 >=20 >=20 >=20 > Another alternative is to make your own templating system. Have it load >=20 > and parse the html file (maybe using one of the xml or html parsers), >=20 > and substitude some sort of field marker for data. But that is >=20 > re-inventing the wheel. >=20 >=20 >=20 > http://wiki.python.org/moin/Templating Firstly thank you for your answer, but iam a bit confised. can i just put the liens you provided me inside "files.html" and thwy will = work? Thats pure pythjon code! for x in xrange(4):=20 print "{0}".format(x)=20 wont html complain?