Inserting-embedding some html data at the end of a .py file

Dave Angel davea at davea.name
Tue Mar 5 19:18:16 CET 2013


On 03/05/2013 12:49 PM, Νίκος Γκρ33κ wrote:
> What extra triple quote?
> There are 2 sets of triple quotes the counter's and the print's !!

There are 3 pairs of triple-quotes.  But one pair is nested inside the 
other, so the interpreter will not handle it the way you apparently 
want.  If you have to use quotes inside quotes, you must either use a 
different kind, or escape them.  Perhaps you wanted something like:

      counter = """
               print '''<center>  etc....
                     <td>font ...
               '''
               """ % data[0]

But this fragment is unreadable to me, so the syntax error is probably 
the least of your worries.

>
> in case htmlpage variable is a .py file i must append a print '''html''' in order for .py code to absorve that code properly no?
>

No clue what that sentence fragment means.

'absorve' isn't an English word, and neither 'absorb' nor 'observe' make 
any sense.

Perhaps if you posted a complete program, and identified it by name, and 
specified the complete environment it runs in, and used English to 
describe what should be appended to what, we'd be able to help.  As it 
is, you've got mixed clues from which that it's both Python 2 and 3, 
running Linux or equivalent, and probably runs on a server.

Using symbol names that make sense would also help.  'htmlpage' is 
apparently a str representing a filename on disk.  'counter' is not an 
integer, but a long string of html.   'data' is apparently a tuple or 
list, and the zeroth element is an int. ??

-- 
-- 
DaveA



More information about the Python-list mailing list