[PyQt] string printing question
    Aaron Racicot 
    aaronr at z-pulley.com
       
    Fri May 15 05:44:26 BST 2009
    
    
  
Try:
outfile.write(str(lineStr))
outfile.write(str(dateStr))
Hope that helps...
A
--------------------------
Aaron Racicot
Z-Pulley Inc.
-----Original Message-----
From: pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Scott Frankel
Sent: Thursday, May 14, 2009 9:02 PM
To: pyqt at riverbankcomputing.com
Subject: [PyQt] string printing question
How does one convert from QString and QBytArray values to plain ascii  
strings for printing?
I would like to print plain ascii text to a file, based on values I  
glean from QLineEdit and QDateEdit fields.  eg:
self.theLineEdit          = QtGui.QLineEdit()
self.theDateEdit          = QtGui.QDateEdit()
lineStr = self.theLineEdit .text()
dateStr = theDateEdit.text()
outfile.write(lineStr)
outfile.write(dateStr)
This yields:
PyQt4.QtCore.QString(u'foo')
PyQt4.QtCore.QByteArray('5/14/09')
When what I want is:
foo
5/14/09
I've tried using toAscii(), toLatin1(), etc., with no change.
Thanks in advance,
Scott
_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
    
    
More information about the PyQt
mailing list