我對python比較陌生。我想用一個不同的詞來替換出現兩次以上的單詞。單詞可以由多個單詞組成。我希望他們被XYZ取代。例如: ABC is a tall person. ABC likes sports. Sports are good for health. ABC is a gold medalist in many sports.
ABC和運動應該替換爲XYZ。像,上面的句子應該是: X
program1.py: a = "this is a test"
for x in a:
print(x)
program2.py: a = """this is a test
with more than one line
three, to be exact"""
for x in a:
print(x)
program3.py: im