How to stop a specific key from working in Python

2024/11/18 21:26:04

My laptop keyboard has a bug and it sometimes presses the number 5 randomly so i tried many things and they didn't work, I tried programming a code that can stop it but i couldn't because i am a beginner.

from pynput.keyboard import Key, Controller
keyboard = Controller()
disable = keyboard.pressed('5')
if deni:KeyboardInterruptcontinue

hopefully this doesn't need imports

Answer

This question does not belong here. You should have put it in https://superuser.com/ as it would have been a whole lot easier and more effective to do it in some other programming language. But if you want to do it in python, first learn python.

Other Options

  1. Try pressing "Fn and Num Lock" or if you don't have "Num Lock" do "Fn and Caps Lock.
  2. Try reinstalling your keyboard driver.
  3. If your keyboard has gotten water inside of it, then put it in rice and let it sit for 2 to 3 days
  4. Buy a new keyboard

Resources

  • http://www.tomshardware.com/answers/id-1972361/keyboard-keys-typing-wrong-multiple-letters.html
https://en.xdnf.cn/q/120026.html

Related Q&A

How do i sort a 2D array or multiple arrays by the length of the array using bubble sort

trying to write a Python function: def compare_lengths(x, y, z) which takes as arguments three arrays and checks their lengths and returns them as a triple in order of length. For example, if the funct…

How to split a string in Python by 2 or 3, etc [duplicate]

This question already has answers here:Split string every nth character(21 answers)How to iterate over a list in chunks(40 answers)Closed 10 years ago.Does anyone know if its possible in python to spli…

.LAS into a .CSV file using python

How to change a .las file into a .csv file? Have been trying myself but no luck no far. I am just looking for something decently short that will save some time when I have to convert big .olas files i…

using pandas read_excel to read from stdin

Note: I have solve this problem as per below:I can use to_csv to write to stdout in python / pandas. Something like this works fine:final_df.to_csv(sys.stdout, index=False)I would like to read in an a…

How to print a string x times based on user input [duplicate]

This question already has answers here:How can I read inputs as numbers?(10 answers)Understanding for loops in Python(4 answers)Closed 1 year ago.I am trying to make a simple application that will pri…

How does .join work in Python?

I want to display each row of a SQL query result on a webpage. I found some code, but I dont understand what this line does.u"<br>".join([u"{0}".format(row.combination) for r…

Login, Navigate and Retrieve data behind a proxy with Python

I want, with a python script, to be able to login a website and retrieve some data. This behind my companys proxy.I know that this question seems a duplicate of others that you can find searching, but …

overflow in exp, python

cant really figure out why this error RuntimeWarning: overflow encountered in exp is showing up. The function Im trying to implement is:Id = lambda t_u, yp: Is * (np.exp((Vin(t_u) - L*yp)/(n_Ut*Ut)) - …

Getting a matlab codes results on python

I have code in matlab whose results I would like to use in python code (as a matrix or as a .dat file). Could anyone tell me how this could be done?

My Status object is not saving in Django

When I enter the shell, I run into the following problem:from users.models import Status from django.utils import timezoneStatus.objects.all() >>> [] p = Status() p.status_time = timezone.date…