[Tutor] Assigning multi line value to a variable

Rohit Mediratta rohit_medi at hotmail.com
Wed Jan 16 00:12:24 CET 2013


Hi,
   I am using Centos 6.3 and python 2.6.6.

When I try to assign a variables value inside a multiple line message, it does not work.

>>>cardName = "ActualCardName"
>>>data = """ <inst dn="root/child">
        <card name=%cardName  descr="testingAgain"> """
>>> print data
 <inst dn="root/child">
        <card name=%cardName  descr="testingAgain"> 


I would like %cardName to be replaced by "actualCardName". As you can see I am trying to use XML and therefore I will have several such replacements that I will need to do.


If someone can suggest a clean way for me to achieve my goal, that would be great.

Please note, my input is going to be several lines long.

thanks,
Rohit

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130115/6118d99f/attachment.html>


More information about the Tutor mailing list