MySQL returned datatype and python outputs different type for different functions -
I have a lot of problems with MySQL returns and it has been inserted into a QT table with Python. To use Basically I would have kept str () around the return, and it used to work for everything, except its That when I am abroad Unicode problems on language and date time so now I did not insert str () and foreign language on the table. However, now there are some problems with some strings 1) I do not include that time When I type 2) Then I Just passed for that time. Now I try to get the integer to display. If data [i] == 1: print data [i] print type (data [i]) data [i] = str (data [i]) / Pre> This results in the following: In addition, if I try to print It returns: In addition, / P> returns: I must be missing something fundamental about my return what caused it? You can not change the data from the fetchall method because it is a Tupal and not a list. The easiest to decide: data = cursor.fetchall ()
: for i category (data): sqlTableWidget.setItem (index, i, QtGui.QTableWidgetItem (data [i]) index = index1
type (data [i]) , it returns
datetime and when I call it the
data [i] = data [i] .strftime ( "% Y-% m-% d% H:% M:% S") It tells me
'Tupal' does not support object item assignment
gt; 1 >> (type 'long')> gt; & Gt; Type error: does not support 'Tulle' object
print list (data [i])
typeError: The 'long' object is not recurring.
if there is no data [i]: data [i] = 'no data' sqlTableWidget.setItem (index, i, qtigui.quitebitalititum (data [i]))
QTableWidgetItem (QtableWidgetItem): Logic 1 Unexpected type 'NoneType'
data = [for the list (i) I cursor.fetchol ()]
Comments
Post a Comment