Is it possible to create a reqex that finds characters that are NOT is a specific set?
Rather than Blacklisting a bunch of characters and replacing them, it would be eas
Try with:
re.sub(r'[^a-zA-Z0-9]', "_", filename)
Yes, use the ^ negation "modifier": r'[^.a-zA-Z0-9]'
^
r'[^.a-zA-Z0-9]'
clean_filename = re.sub(r'[^.a-zA-Z0-9]', "_", filename)