from collections.abc import Iterable
from typing import TypeAlias
FromTo = tuple[str, str] # 3.10之前
FromTo: TypeAlias = tuple[str, str] # 3.10之后推荐使用TypeAlias
def zip_replace(text: str, changes: Iterable[FromTo]) -> str:
for from_, to in changes:
text = text.replace(from_, to)
return text
标签:3.10,text,别名,replace,FromTo,str,类型,TypeAlias
From: https://www.cnblogs.com/weiweivip666/p/17661347.html