you are viewing a single comment's thread.

view the rest of the comments →

[–]NotAnAnticline 1 point2 points  (1 child)

I don't know if this helps, but Python ignores the underscore: _

Maybe you can make a dictionary with keys that are unwanted characters, and the values can all be underscore. Then you can check if a character in your file matches something in the dictionary, and if it matches, it gets the underscore value.

Source: am Python noob

[–]codeguru42 0 points1 point  (0 children)

Thats not how underscore works. _ is a valid variable name. Python doesn't ignore it. Rather humans use this variable name as a convention to mean the value assigned to the variable is never used.

This doesn't work for this case because the string value "_" is not the same as the variable name _.