내 코드는 목록으로 분리 된 문자열을 반복하고 모든 이전 발생을 새 것으로 바꾼 다음 문자열을 반환합니다. 귀하의 채널이 동일한 오래된 않는 경우한 건의 해지
가def replace(s, old, new):
ch=""
i=0
newMsg=s.split()
print newMsg
for ch in newMsg:
if ch==old:
newMsg[i]=newMsg[i].replace(old, new)
else:
i = i +1
return ' '.join(newMsg)
왜 's.replace (old, new)'가 아닌가? – DJK
죄송합니다. < –