Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
import re, sys m = re.sub('(','',m)
我想清除 "(",")" 。我该怎么办?
不要对这么简单的事情使用正则表达式;使用翻译:
Python 字符串文档
>>> str = "This is a (string) (example)..." >>> str.translate(None, "()") 'This is a string example...' >>>
p = re.compile(r'<a>.*?</a>') my_source = p.sub('<a></a>', my_source, re.DOTALL)