I need to change some characters that are not ASCII to \'_\'. For example,
Tannh‰user -> Tannh_user
With the magical regex [ -~] one can solve it:
import re
re.sub(r"[^ -~]", "_", "Tannh‰user")
# 'Tannh_user'
Explanation:
[ -~] captures all ascii chars^we can capture all non-ascii characters