码迷,mamicode.com
首页 > 编程语言 > 详细

python遗留问题

时间:2018-06-25 23:00:10      阅读:318      评论:0      收藏:0      [点我收藏+]

标签:char   bsp   source   sci   driver   most   ack   pytho   脚本   

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

python遗留问题

标签:char   bsp   source   sci   driver   most   ack   pytho   脚本   

原文地址:https://www.cnblogs.com/xiaxiaoxu/p/9226572.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!