如何使Python结束一个循环,然后按键的按下键,然后在循环中不断按下左键单击并右键单击?
我对Python和编码相对较新。我创建了一个脚本来帮助我执行重复任务。我的脚本很好,除了我从字面上找不到杀死它的方法。我的脚本不断按下左右鼠标按钮,我希望解决方案在另一个选项卡中放出时杀死它。我已经尝试了如果键盘。IS_PREDSER('e')break
,并使用pynput并使用正确的代码(我真的无法在此网站上很好地弄清楚格式代码)。我可以使用什么解决方案?到目前为止,我的脚本是:
while True:
mouse.click(Button.right)
enter code here
time.sleep(0.90)
mouse.click(Button.left)
I am relatively new to python and coding in general. I've created a script to help me perform a repetitive task. My script is perfectly fine, except the part where I literally can't find a way to kill it. My script constantly presses the left and right mouse buttons and I would like a solution to kill it while tabbed out in another tab. I've tried if keyboard.is_pressed('e') break
with importing pynput and using the right code (I couldn't really figure out format code well on this website). What solutions can I use? My script as of now is:
while True:
mouse.click(Button.right)
enter code here
time.sleep(0.90)
mouse.click(Button.left)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按下键时,断路语句将触发,while循环将终止。如果不按下键,将重复序列。
When the key is pressed the break statement will trigger and the while loop will terminate. If the key is not pressed the sequence will be repeated.