분리 기호에서 문자열을 대문자로 사용하려고 할 때 동작이 발생했습니다. 이해가되지 않습니다. 누군가 루프에서 되돌려 진 문자열을 왜 설명 할 수 있습니까? 감사.루프에서 문자열의 파이썬 동작
s = 'these-three_words'
seperators = ('-','_')
for sep in seperators:
s = sep.join([i.capitalize() for i in s.split(sep)])
print s
print s
stdout:
These-Three_words
These-three_Words
These-three_Words