[Tutor] inserting variables into a docstring

Bill Allen wallenpb at gmail.com
Sun Aug 22 06:10:19 CEST 2010

I am trying to build an HTML body text for an email using a docstring with
variables inserted a certain points.  It all works just fine, except that
the first instance of the variable "pecn" in the HTML link does not get
inserted into the text.  The second instance of "pecn" gets inserted ok into
that HTML link.   What is the right way to do this or is there a better way
in general?

This my code:

pecn = "5022543"
pecn_project = "F876540"
pdesc = "some sort of ECN for who knows what reason!"

newMail.HTMLBody = """
ECN number """+pecn+""" on Project """+pecn_project+""" has been closed.
Below is a link to the ECN on the intranet.
<a href="http://web_server_at_work.com/cgi-bin/part-url.cgi?ecn="
"""+pecn+""" "">"""+pecn+"""</a>
ECN Description:

ECN Effect of Change Comments:
    (still need to work on this part)

R&D Information:
    (still need to work on this part)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100821/a0d9bd35/attachment.html>

More information about the Tutor mailing list