str1 = "series of sentences that are organized and coherent, and are all related to a single topic. Almost every piece of writing you do that is longer than a few **sentences** should be organized into paragraphs."
REPLACE_STRING = {"series":"web" , "sentence":"long paragraph"}
输出:
web of long paragraph that are organized and coherent, and are all related to a single topic. Almost every piece of writing you do that is longer than a few **long paragraph** should be organized into paragraphs.
基本上需要一次性用字典中的键替换str中的所有值
试试这个
一次性:
使用循环:
相关问题 更多 >
编程相关推荐