'How can I make a variable an index in lists (python)
I am a complete beginner at coding, but I am trying to write a program that helps me make my keylogger data better readable. I have a keylogger on my device because I want to study my personal typing habits because I want to make a personalized keyboard layout :) As of now, my keylogger gives me something like this:
2022-05-08 07:58:29,149 - 't'
2022-05-08 07:58:29,249 - 'e'
2022-05-08 07:58:29,386 - 'r'
2022-05-08 07:58:29,670 - Key.backspace
2022-05-08 07:58:29,959 - 'l'
2022-05-08 07:58:30,144 - 'l'
2022-05-08 07:58:30,250 - 'e'
2022-05-08 07:58:30,349 - 'r'
2022-05-08 07:58:30,630 - 's'
2022-05-08 07:58:30,958 - Key.shift
2022-05-08 07:58:31,018 - '?'
2022-05-08 07:58:31,234 - Key.space
2022-05-08 07:58:31,494 - Key.shift_r
Now I have sorted out all that stuff like the date and hyphens and stuff using Microsoft Word "Find and Replace" (I don't know how to change the keylogger code so that it leaves the ascii date away so I just went with the current format), but I have the problem that I don't want to have typos in my keylogger data, so when I pressed a backspace, I obviously want my program to delete the last two instances that I've typed in my list...
This is what my code looks like currently:
sample = (input)
x= 0
for x True:
if sample(x) == "Key.backspace":
del sample[x, x-1]
x = x + 1
input('')
But it doesn't seem to work... can somebody please figure out how I can use x as index for my list?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|