python == 判断异常,,UnicodeWarning,求助

gudaobeige 2013-06-28 03:56:02

for row in csv.reader(open(r'testm.csv','rb'),delimiter=','):
sql=""
cursor = MySqlConn.cursor()
cursor.execute(sql)
dbRet=cursor.fetchone()

if not tuple(row)==dbRet:
#其他操作


在ubuntu下if判断出现异常信息:
UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal.

coding=utf8,请问各位大侠,应该怎么处理?
...全文
421 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
gudaobeige 2013-06-28
  • 打赏
  • 举报
回复
解决了,用codecs可以 谢谢你,分给你了
ImN1 2013-06-28
  • 打赏
  • 举报
回复
py3 open(r'testm.csv','r', encoding='utf-8') py2 不清楚

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧