I have a string with which i want to replace any character that isn\'t a standard character or number such as (a-z or 0-9) with an asterisk. For example, \"h^&ell`.,|o w
Try:
s = filter(str.isalnum, s)
in Python3:
s = ''.join(filter(str.isalnum, s))
Edit: realized that the OP wants to replace non-chars with '*'. My answer does not fit