天天看点

在robotframwork中使用正则表达式注意事项,比如在python中\,在rf中要用\\

在python中:

#正则匹配小数
import re

a="aaa>12.12<bbb"

b=re.findall(">([\d]*[\.][\d]*)<",a)
print(b)


#执行结果:['12.12']
           

在rf中:

${list} Evaluate re.findall(">([\\d]*[\.][\\d]*)<","aaa>12.12<bbb") re

#这类似符号都要注意转义问题,其实这是rf和底层python之间进行转义时出问题了,rf前段\\转化为python时变成\