[PyQt] string printing question

Scott Frankel frankel at circlesfx.com
Fri May 15 17:28:09 BST 2009


Thanks!


On May 14, 2009, at 9:44 PM, Aaron Racicot wrote:

> 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
>
>

Scott Frankel
President/VFX Supervisor
Circle-S Studios

www.circlesfx.com
510-339-7477 (o)
510-332-2990 (c)










More information about the PyQt mailing list