Variables in strings..

Gabriel Ambuehl gabriel_ambuehl at buz.ch
Mon Jul 24 07:50:21 EDT 2000


Hello Steve,
Monday, July 24, 2000, 12:52:30 PM, you wrote:

>   print "Hello %s" % names[1]
> to the eyes of anyone but a Perl afficionado.

Perhaps. But in real world (tm) CGI scripts, one needs more than just
one variable in there. I've got Perl scripts who insert aroun 40
variables (including array slices) during one print <<"EOF"
instruction. I could live with the "%(myvar)" % vars() syntax if there
would be a possibility to reference to lists and dictionary entries as
well. Without it, it's a real pain to quickly write CGI scripts.
Hell,
content='<tr> <td> <a href="http://'+ pair[0] + '">' + pair[0]+ '</a> </td> <td>' + pair[1] + '</td><td><a href="' + PathToScript
etc is nothing I can consider readably. (though pair1=pair[1]
and pair2=pair[2] would do the job but that's not really what I'd
consider elegant...)






Best regards,
 Gabriel






More information about the Python-list mailing list