s=input("请输入文本字符串:")
c=input("need replace string:") #find string in s by c
a=len(c)
c1=input("new:")
s1=""
i=0
while i <len(s):
j=s[i:i+a]
if j==c:
s1=s1+c1
i=i+len(c1)
else:
s1=s1+s[i]
i+=1
if s1==s:
print("No find")
else:
print(s1)
python‘s How to replace string
最新推荐文章于 2024-11-13 17:26:18 发布