elis aeris wrote:
> def winlist(title):
>     f.write("winlist(\"title\")")
> 
> 
> 
> how about if "title" is a variable?

I assume, from your example, that you want to write the value of the variable 
'title' enclosed in quotation marks.  We once again use an escape sequence to 
output quotation marks, but this example also utilizes string formatting to 
convert the value of 'title' to a string and place it between the quotation 
marks in the output:

def winlist(title):
    f.write("\"%s\"" % title)

Please note that I have never used the write function before, but I just ran a 
quick test with the python interpreter and that appears to be valid code.

For more information on string formatting, see here:

http://docs.python.org/lib/typesseq-strings.html


-Robert
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to