1. import re
    2. string = "Hello 123 World 456"
    3. new_string = re.sub("d", "#", string)
    4. print(new_string)
    5. # 输出:Hello ### World ###