📜  如何替换列表python代码示例中的字符串

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

代码示例1
Use str. replace() to replace a string in a list
strings = ["a", "ab", "aa", "c"]
new_strings = []
for string in strings:
new_string = string. replace("a", "1") Modify old string.
new_strings. append(new_string) Add new string to list.
print(new_strings)