📜  在 python 代码示例中使用 for 循环复制列表

📅  最后修改于: 2022-03-11 14:45:28.225000             🧑  作者: Mango

代码示例1
her_clothes = ["women's trousers", "women's shirts", "women's shoes", "women's sunglasses"]
his_clothes = []

for clothes in her_clothes:
    his_clothes.append(clothes.replace("women's", "men's"))

print(his_clothes)

# output - ["men's trousers", "men's shirts", "men's shoes", "men's sunglasses"]