-3

I wrote a get data from mysql by phthon like this

 query = ("select distinct packet  from http_sum where downloadspot = 'dilian'")
    cursor.execute(query)
    for (packet) in cursor:
       cdndata_name.append(packet)

As you see,it is so easy.but i got data like this : (u'panzarcn.rar',) how to convert it to string ,thank you

qin peter
  • 339
  • 3
  • 15

1 Answers1

1

That is not a wrong data type, it is unicode and it is the data type you should be using to deal with text in your code. If you realy need to convert it to str look at the answers in the question linked by @Lafexlos.

Community
  • 1
  • 1
Stop harming Monica
  • 12,141
  • 1
  • 36
  • 56