Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'append': 0.07; 'subject:file': 0.07; 'python': 0.09; '"': 0.09; "'''": 0.09; 'fails.': 0.09; 'inserted': 0.09; 'snippet': 0.09; 'cc:addr :python-list': 0.10; 'template': 0.11; '"a")': 0.16; '.py': 0.16; 'beautifully': 0.16; 'f.read()': 0.16; 'inserting': 0.16; 'opened.': 0.16; 'string': 0.17; 'wrote:': 0.17; 'tries': 0.17; 'changes': 0.20; 'email addr:gmail.com>': 0.20; 'file.': 0.20; 'do.': 0.21; 'skip:= 20': 0.22; 'cc:2**0': 0.23; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'displays': 0.27; 'message-id:@mail.gmail.com': 0.27; 'quoting': 0.29; 'subject:end': 0.29; 'subject:some': 0.29; 'url:mailman': 0.29; 'skip:& 10': 0.29; 'mode': 0.30; 'url:python': 0.32; 'file': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'skip:h 40': 0.33; 'subject: .': 0.33; 'subject:data': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'open': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'subject:-': 0.40; 'end': 0.40; 'url:mail': 0.40; '8bit%:50': 0.65; '8bit%:100': 0.70; '</td>': 0.84; '<img': 0.84; '2013': 0.84; '8bit%:65': 0.84; 'url:show': 0.84; 'joel': 0.91; 'write:': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=wJdfBVrbHXicIk5Sp5fl5lInQvkBkOkMwe8lSUDYZG4=; b=Q0Yb006MbrRiP6aQxiOJ725t3cusbsuILOvm797PFIourLgurT7Hyh2z0K8TAWQzbw V+PjAYUTWCdP3g6zrl/eaf7DBuWjfQdV6TVCUgH4GJHb9C1ZBn2bOUmZOm6QKLJ3XgCp eVDeRJUwbBTVT09Ygb6GhL1WQPl6YrSPGzaPaoznbl55TyZPxXl4o9oHwRVNV7UH1Hus ixWFsOB+ck7TMLCoLkrH5cY+6RfZ+afBwfU1WghU7JYn51y7h8X7QoAsRqAtP5lZWttS JKtMogmRNM1fXAYo+4p8pZyY7H5bD6UZGR3bHMlGUutlWh/DvLkxtF1lCOOniUyXACwU wNbA== MIME-Version: 1.0 X-Received: by 10.58.46.134 with SMTP id v6mr10383385vem.45.1362512040253; Tue, 05 Mar 2013 11:34:00 -0800 (PST) In-Reply-To: References: <7e0a8562-9a48-4f5a-804d-3751733288f0@googlegroups.com> <14d3a13e-9d95-49b5-9d58-205021b79630@googlegroups.com> Date: Tue, 5 Mar 2013 14:33:59 -0500 Subject: Re: Inserting-embedding some html data at the end of a .py file From: Joel Goldstick To: =?UTF-8?B?zp3Or866zr/PgiDOk866z4EzM866?= Content-Type: multipart/alternative; boundary=089e0122a2e629646f04d7328e19 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: , Newsgroups: comp.lang.python Message-ID: Lines: 194 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362512049 news.xs4all.nl 6860 [2001:888:2000:d::a6]:52489 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40563 --089e0122a2e629646f04d7328e19 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 5, 2013 at 1:53 PM, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 =CE=93=CE=BA= =CF=8133=CE=BA wrote: > Let's focus on just the following snipper please: > > f =3D open( some_python_file ) > > htmldata =3D f.read() > counter =3D ''' print( " >
> >
bgcolor=3Dblack> > > > " ) > ''' % data[0] > > #render template > template =3D htmldata + counter > print ( template ) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > What this snippet tries to accomplish is append the following string > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > counter =3D '''
> >
=CE=91= =CF=81=CE=B9=CE=B8=CE=BC=CF=8C=CF=82 > =CE=95=CF=80=CE=B9=CF=83=CE=BA=CE=B5=CF=80=CF=84=CF=8E=CE=BD http://superhost.gr/?show=3Dstats"> %d
bgcolor=3Dblack> > > > ''' % data[0 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > at the end of the the python script file that it currently opened. > I'am using the print statemnt inside the triple quoted string so to appen= d > that html data by inserting a print statemnt but although i have changes > the type of quoting it still fails. > > If i try to append that html data to an .html file they are inserted > beautifully but inside a .py file they dont. > > I just need to append that string after the end of a .py file. that's all > i want to do. > -- > http://mail.python.org/mailman/listinfo/python-list > print displays to the console. To write to a file open file in 'append' mode and write: with open("test.py", "a") as myfile: myfile.write("appended text") --=20 Joel Goldstick http://joelgoldstick.com --089e0122a2e629646f04d7328e19 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Tue, Mar 5, 2013 at 1:53 PM, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 =CE= =93=CE=BA=CF=8133=CE=BA <nikos.gr33k@gmail.com> wrote:
Let's focus on just t= he following snipper please:

f =3D open( some_python_file )

htmldata =3D f.read()
counter =3D ''' print( "
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <center><a href= =3D"mailto:support@superhost.g= r"> <img src=3D"/data/images/mail.png"> </a&= gt;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <center><table border=3D2 cellpadd= ing=3D2 bgcolor=3Dblack>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &= lt;td><font color=3Dlime>=CE=91=CF=81=CE=B9=CE=B8=CE=BC=CF=8C=CF= =82 =CE=95=CF=80=CE=B9=CF=83=CE=BA=CE=B5=CF=80=CF=84=CF=8E=CE=BD</td>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &= lt;td><a href=3D"http://superhost.gr/?show=3Dstats"><font co= lor=3Dcyan> %d </td>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 " )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 ''' % data[0]

#render template
template =3D htmldata + counter
print ( template )
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D

What this snippet tries to accomplish is append the following string

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 c= ounter =3D ''' <center><a href=3D"mailto:support@superhost.gr"> <img= src=3D"/data/images/mail.png"> </a>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <center><table border=3D2 cellpadd= ing=3D2 bgcolor=3Dblack>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &= lt;td><font color=3Dlime>=CE=91=CF=81=CE=B9=CE=B8=CE=BC=CF=8C=CF= =82 =CE=95=CF=80=CE=B9=CF=83=CE=BA=CE=B5=CF=80=CF=84=CF=8E=CE=BD</td>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &= lt;td><a href=3D"http://superhost.gr/?show=3Dstats"><font co= lor=3Dcyan> %d </td>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 ''' % data[0
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

at the end of the the python script file that it currently opened.
I'am using the print statemnt inside the triple quoted string so to app= end that html data by inserting a print statemnt but although i have change= s the type of quoting it still fails.

If i try to append that html data to an .html file they are inserted beauti= fully but inside a .py file they dont.

I just need to append that string after the end of a .py file. that's a= ll i want to do.
--
http://mail.python.org/mailman/listinfo/python-list

print= displays to the console.=C2=A0 To write to a file open file in 'append= ' mode and write:

with open("test.py", "a") as myfile:
    myfile.write("appended text")
=20 =20 =20

--
--089e0122a2e629646f04d7328e19--
=CE=91= =CF=81=CE=B9=CE=B8=CE=BC=CF=8C=CF=82 > =CE=95=CF=80=CE=B9=CF=83=CE=BA=CE=B5=CF=80=CF=84=CF=8E=CE=BD http://superhost.gr/?show=3Dstats"> %d