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.
我是 grep 的新手,我熟悉 Python。我的问题是用 <em>text</em> 查找并替换引号内的每个字符串,例如“text”
源文件有html形式
谢谢
这样就行了
import re s = '"text" "some"' res = re.subn('"([^"]*)"', '<em>\\1</em>', s)[0]