Python+selenium Python中字符串转换成数字,运行结果相等,但是值不相等

wangxin5644 2017-09-23 07:10:42
if string.atof(Account_Equity1) == string.atof(Account_Equity) - string.atof(money) and \
string.atof(Transfer_Account_Equity1) == string.atof(Transfer_Account_Equity) + string.atof(money):
print u"转账成功后,交易账户管理净值校验OK"
else:
print u"转账成功后,交易账户管理净值校验错误"

print string.atof(Account_Equity1)
print string.atof(Account_Equity) - string.atof(money)
print string.atof(Transfer_Account_Equity1)
print string.atof(Transfer_Account_Equity) + string.atof(money)

结果:
转账成功后,交易账户管理净值校验错误
9828.79
9828.79
111.08
111.08
...全文
1175 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangxin5644 2017-09-23
  • 打赏
  • 举报
回复
和小数位没有关系,都是小数点后两位
wangxin5644 2017-09-23
  • 打赏
  • 举报
回复
和1楼没关系,就是时对时不对,不对的时候多
wangxin5644 2017-09-23
  • 打赏
  • 举报
回复
也有正确的时候,不知道什么原因
wangxin5644 2017-09-23
  • 打赏
  • 举报
回复
string.atof(Account_Equity)是9828.8,而不是9828.80,是不是和这个有关系,如果有关系,怎么解决呢
qq_37014158 2017-09-23
  • 打赏
  • 举报
回复
是不是跟数字后面的小数位有关?

3,424

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 其他开发语言
社区管理员
  • 其他开发语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧