我正在编写python脚本,从sqlite3数据库中提取xbmc媒体应用程序的数据。在
我可以看到,在我的代码中,它将使用unicode对象提取数据,其中我将有字符串(u'、u和{}。在
我想把它转换回普通字符串,从unicode对象转换成utf8。在
代码如下:programs = None
daysLimit = 14
start = datetime.datetime.now()
end = start + datetime.timedelta(days = daysLimit)
cur.execute('SELECT channel, title, start_date, stop_date FROM programs WHERE channel')
programs = cur.fetchall()
print(programs)
cur.close()
以下是xbmc日志:
^{pr2}$
我想忽略字符串(u'、u和L,所以我想让它看起来像这样:'101 ABC FAMILY ', 'The Middle - The Ditch', 20140520170000, 20140520173000,
'101 ABC FAMILY ', 'The Goonies', 20140520173000, 20140520200000,
'101 ABC FAMILY ', 'Pirates of the Caribbean: On Stranger Tides', 20140520200000, 20140520230000,
'101 ABC FAMILY ', 'The 700 Club', 20140520230000, 20140521000000,
'101 ABC FAMILY ', 'The Fresh Prince of Bel-Air - Day Damn One', 20140521000000, 20140521003000,
and so on...
您能告诉我如何使用python2.6版本将unicode对象转换为utf8吗?在