Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40563
| References | (1 earlier) <fea70537-617e-4694-ace0-65568039e574@googlegroups.com> <mailman.2899.1362505528.2939.python-list@python.org> <14d3a13e-9d95-49b5-9d58-205021b79630@googlegroups.com> <mailman.2903.1362507510.2939.python-list@python.org> <cc677143-85d3-4ed2-9627-3872725ff1a3@googlegroups.com> |
|---|---|
| Date | 2013-03-05 14:33 -0500 |
| Subject | Re: Inserting-embedding some html data at the end of a .py file |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2906.1362512049.2939.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Tue, Mar 5, 2013 at 1:53 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> Let's focus on just the following snipper please:
>
> f = open( some_python_file )
>
> htmldata = f.read()
> counter = ''' print( "
> <center><a href="mailto:support@superhost.gr">
> <img src="/data/images/mail.png"> </a>
> <center><table border=2 cellpadding=2
> bgcolor=black>
> <td><font color=lime>Αριθμός
> Επισκεπτών</td>
> <td><a href="
> http://superhost.gr/?show=stats"><font color=cyan> %d </td>
> " )
> ''' % data[0]
>
> #render template
> template = htmldata + counter
> print ( template )
> =============================
>
> What this snippet tries to accomplish is append the following string
>
> =========================================
> counter = ''' <center><a href="mailto:support@superhost.gr">
> <img src="/data/images/mail.png"> </a>
> <center><table border=2 cellpadding=2
> bgcolor=black>
> <td><font color=lime>Αριθμός
> Επισκεπτών</td>
> <td><a href="
> http://superhost.gr/?show=stats"><font color=cyan> %d </td>
> ''' % data[0
> =========================================
>
> 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 append
> 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")
--
Joel Goldstick
http://joelgoldstick.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 06:35 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:11 -0800
Re: Inserting-embedding some html data at the end of a .py file Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-05 17:19 +0000
Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-05 12:25 -0500
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:39 -0800
Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-05 12:45 -0500
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:49 -0800
Re: Inserting-embedding some html data at the end of a .py file Dave Angel <davea@davea.name> - 2013-03-05 13:18 -0500
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 10:53 -0800
Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-05 14:33 -0500
Re: Inserting-embedding some html data at the end of a .py file Dave Angel <davea@davea.name> - 2013-03-05 14:48 -0500
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 10:53 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:49 -0800
Re: Inserting-embedding some html data at the end of a .py file Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-05 17:53 +0000
Re: Inserting-embedding some html data at the end of a .py file Roland Koebler <r.koebler@yahoo.de> - 2013-03-06 10:00 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 12:04 -0800
Re: Inserting-embedding some html data at the end of a .py file Dave Angel <d@davea.name> - 2013-03-05 16:02 -0500
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 14:49 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 14:49 -0800
Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-05 22:29 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 14:47 -0800
Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-06 00:19 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 15:39 -0800
Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-06 01:06 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 22:12 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 22:12 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 23:48 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 23:48 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 15:18 -0800
Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-07 01:25 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:35 -0800
Re: Inserting-embedding some html data at the end of a .py file Roland Koebler <r.koebler@yahoo.de> - 2013-03-07 09:58 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:05 -0800
Re: Inserting-embedding some html data at the end of a .py file Lele Gaifax <lele@metapensiero.it> - 2013-03-07 10:22 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:28 -0800
Re: Inserting-embedding some html data at the end of a .py file Lele Gaifax <lele@metapensiero.it> - 2013-03-07 10:50 +0100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:55 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:55 -0800
Re: Inserting-embedding some html data at the end of a .py file Chris Angelico <rosuav@gmail.com> - 2013-03-07 21:19 +1100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:34 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:34 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 03:51 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 03:51 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:28 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:09 -0800
Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-07 05:28 -0500
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 04:06 -0800
Re: Inserting-embedding some html data at the end of a .py file Chris Angelico <rosuav@gmail.com> - 2013-03-07 23:17 +1100
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 04:06 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:09 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:05 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:35 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:42 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:42 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 15:18 -0800
Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 15:39 -0800
csiph-web