gpt4 book ai didi

python - Pywinauto type_keys() 省略字符串中的 "%"

转载 作者:太空宇宙 更新时间:2023-11-04 02:08:04 25 4
gpt4 key购买 nike

当尝试在 Pywinauto 0.6.5 中使用 type_keys() 向表单输入字符串 'customer asked for 30% discount' 时,它发送的输出是'客户要求 30 折扣' 省略 '%'

尝试转义字符:

  1. control.type_keys('客户要求 30%% 折扣',with_spaces=True)
  2. control.type_keys('客户要求 30% 的折扣',with_spaces=True)

但它仍然省略了'%'

在控制台字符串输出中正确打印数据时。所以这不是 Python 3.7 问题。

最佳答案

正如 Redem 已经发现的,一些特殊符号必须这样转义:

 control.type_keys('customer asked for 30{%} discount', with_spaces=True)

或方法.set_edit_text()可用于编辑框控件:

control.set_edit_text(r'customer asked for 30% discount')

关于python - Pywinauto type_keys() 省略字符串中的 "%",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54208079/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com