如果a中包含如下字符中的一个或多个,则将其替换成下划线/:*"<>|?此行凑字数,实在想不到还能打什么
import re strs = "/:qw\"<a>|?12" result = re.sub(r"[?\\*|\"<>:/]", "_", strs) print(result)