python遗留问题

def assert_element_in_page_source(s):
print type(s)
print s
#assert s in driver.page_source
command='assert_element_in_page_source(u"退出")'
print "type(command)",type(command)
eval(command)

 

执行脚本文件。报错如下错误,没找到原因,后续调查

D:\test>python test.py
ascii
type(command) <type 'str'>
<type 'unicode'>
Traceback (most recent call last):
File "test.py", line 85, in <module>
eval(command)
File "<string>", line 1, in <module>
File "test.py", line 81, in assert_element_in_page_source
print s
UnicodeEncodeError: 'gbk' codec can't encode character u'\x80' in position 1: illegal multibyte sequence

posted @ 2018-06-25 22:05  夏晓旭  阅读(257)  评论(0编辑  收藏  举报