Is digit, aplha or math symbol
<p>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.</p>

<p>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?</p>

<pre><code>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
</code></pre>

<hr>

<p>Edit:</p>

<p>I am using <code>pyHook</code> to get the key event and using <code>event.Ascii</code> to get the Ascii value then using <code>chr(event.Ascii)</code> to get the character</p>
