图片左边是城市全称,右边是城市简写。
现在有一句话“this is Republic of Korea,that is United States of America”,要将其中的城市全称替换成城市简写。
#"Republic of Korea"替换成 South Korea
s="this is Republic of Korea,that is United States of America"
dict={"Republic of Korea": "South Korea", "United States of America": "United States", "United Kingdom of Great Britain and Northern Ireland": "United Kingdom", "China, Hong Kong Special Administrative Region": "Hong Kong"}
for key in dict:
s=s.replace(key,dict[key])
print(s)