UnicodeDecodeError: 'utf8'

UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 0: invalid start byte

自动化脚本遇到了这个问题,访问的页面用的utf8,为什么不行呢?

decode的作用是将其他编码的字符串转换成unicode编码,如str1.decode('gb2312'),表示将gb2312编码的字符串转换成unicode编码。

encode的作用是将unicode编码转换成其他编码的字符串,如str2.encode('gb2312'),表示将unicode编码的字符串转换成gb2312编码。

print u"输入错误,已退出".decode('utf8').encode('mbcs')

 

 

火狐浏览器登录遇到下面的问题:

selenium.common.exceptions.ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
Stacktrace

 

posted @ 2016-03-08 14:31  爬虫之家  阅读(1677)  评论(0编辑  收藏  举报