Development/Python
[Python] replace가 안될 때
곽진돔
2023. 3. 2. 21:04
변수를 재할당하라고 하지만
(아래처럼 result에 결과값을 저장)
text = "abcde"
result = text.replace('abc','')
이래도 안될 경우에는 ! 대체할 문자열에 문제가 있을 수 있다.
나의 경우는 터키어를 바꾸려고 했었는데, 지원이 안되는 것 같다. (Ö)
다른 문자열로 테스트해보니 잘됨 ㅎㅎ
유니코드나 치환처리를 해줘야 사용가능할 것 같다 ! 일단은 split으로 대체하여 사용해야겠다.
(삽질 오래했넹..)
How can I replace Unicode characters with Turkish characters in a text file with Python
I am working on Twitter. I got data from Twitter with Stream API and the result of app is JSON file. I wrote tweets data in a text file and now I see Unicode characters instead of Turkish character...
stackoverflow.com