Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8376505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:26:48+00:00 2026-06-09T15:26:48+00:00

I have a logger that listens to sequences such as equations, but I need

  • 0

I have a logger that listens to sequences such as equations, but I need to remove all the keypresses like “L_control” or “shift”, what I do is get the ascii number and then use chr(event.Ascii) but it comes back with the ctrl and shift presses as a space.

I’m currently using this to remove all the characters I don’t want but it doesn’t seem to work. Any ideas of improvements?

def removeChars(l):
    acceptedChars = ["[", "]", "+", "-", "/", "*", "^", "*", "(", ")"]
    newL = ""
    for x in range(0, len(l)):
        if l[x].isalpha() or l[x] in acceptedChars or l[x].isdigit():
            newL = newL + l[x]
    return newL

Edit:

I am using pyHook to get the key event and using event.Ascii to get the Ascii value then using chr(event.Ascii) to get the character

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:26:49+00:00Added an answer on June 9, 2026 at 3:26 pm

    What about something like this?

    import string
    acceptedChars = set(string.printable)
    newL = ''.join([ x for x in l if x in acceptedChars])
    

    Edit:

    You can use anything in set() to match to for example to just get digits, letters, and selected symbols:

    acceptedChars = set(string.digits + "[]()+-/*^=!<>" + string.letters)
    newL = ''.join([ x for x in l if x in acceptedChars])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a logger class that is used all across my application, both in
I have a logger in a c++ application that uses defines as follows: #define
I've a problem with celery's logger. I have a function that renders frames. I
I have a Matlab program that is running longer than I'd like it to.
I have written a windows service in C# that essentially listens for commands on
I have a singleton logger that contains a vector. Objects from outside can append
I have an IP logger that logs every request on my site. I have
OK, I've tried but I just don't get it. I have two classes logger
I have a sortable default table model with ListSelectionListener that listens for a doubleclick
I have a small method I use to disable my socket that listens for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.