Reputation: 1
from pynput.keyboard import Key, Controller
keyboard = Controller()
import time
import random
while True:
timebetweentypes = random.randint(300, 86400)
time.sleep(timebetweentypes)
typed = random.choice('1''2''3''4''5''6''7''8''9''q''w''e''r''t''y''u''i''o''p''a''s''d''f''g''h''j''k''l''z''x''c''v''b''n''m''Q''W''E''R''T''Y''U''I''O''P''A''S''D''F''G''H''J''K''L''Z''X''C''V''B''N''M''!''"''£''$''%''^''&''*''('')'',''.''<''>''/''?''@'':'';''~''#'"'"
keyboard.type(typed)
** The word 'keyboard' on line 9 gets highlighted in red and python tells me that it's a syntax error.
Upvotes: 0
Views: 112
Reputation: 63
Upvotes: 1
Reputation: 188
You missed a )
at the line behind all the characters. They think you are continuing the line so the final line will not work.
Upvotes: 1
Reputation: 1635
Close the bracket on the 8th line. Also you've to separate the characters with a comma. A much simpler way to do it is
typed = random.choice('1 2 3 4 ... # "'.split())
(... represents all the characters you want. I'm just too lazy to type out.)
Upvotes: 1
Reputation:
In the typed
variable, there must be a comma after each object like:
'A','B','C','D'
…
Upvotes: 1