Writing to file
Alex Martelli
aleaxit at yahoo.com
Fri Oct 13 18:20:28 EDT 2000
"j" <keisari_ at hotmail.com> wrote in message
news:39E71DEB.D543820A at hotmail.com...
> How can i write string "test string" into file "test.txt".
If that is ALL you want the file to contain,
open("test.txt","w").write("test string")
> How can i print
> i am a "monkey"
>
> In perl that would be
> print qq(i am a "monkey");
In Python,
print 'i am a "monkey"',
(note the trailing comma, to suppress the default
newline) is probably most common & idiomatic.
Alex
More information about the Python-list
mailing list