UnicodeDecodeError: 'utf8'

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

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

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

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

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

 

 

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

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

相关文章
相关标签/搜索