I am receiving an Invalid Syntax error on my except statement. The code runs fine until I add in the except
import pyautogui
print('Press Ctrl-C to quit.')
while True:
pyautogui.click(1624, 967)
except KeyboardInterrupt:
print('\nDone.')
I'm sure I'm just missing something silly.
Thank you!
You forgot to add try
statement.
import pyautogui
print('Press Ctrl-C to quit.')
try:
while True:
pyautogui.click(1624, 967)
except KeyboardInterrupt:
print('\nDone.')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.