[PyKDE] Writing with QTextStrem

Eric Jardim ericjardim at gmail.com
Wed Feb 9 12:10:47 GMT 2005


Hi,

I was trying to do a simple write of a strings to a text file, but the
"<<" does not work with Python like it do in C++.

What is the corresponding way of doing that in PyQt:

QFile file("file.txt");
QTextStream ts(&file);
 ts << "My string" << "\n";
 file.close();

I read somewhere that the "<<" operator was not implemented "yet", but
I don't know if that assertion is still valid.

Anyway, how would you guys do this kind of simple writing?

I will be using this for writing a tutorial example of how to do
simple and powerfull applications with PyQt.

thanks in advance, 

[Eric Jardim]




More information about the PyQt mailing list