擅长:python、mysql、java
<p>以下是您可能想要做的:</p>
<pre><code>for i in range(0, int(n)):
if n == 0:
pyautogui.typewrite(msg + '\n')
while not keyboard.is_pressed("esc"): # replace True with this, exits the loop when 'esc' is pressed
for i in range(0, int(n)):
pyautogui.typewrite(msg + '\n')
else:
print("You pressed esc")
</code></pre>