[Python] replace가 안될 때

2023. 3. 2. 21:04·Development/Python

변수를 재할당하라고 하지만

(아래처럼 result에 결과값을 저장)

text = "abcde"
result = text.replace('abc','')

이래도 안될 경우에는 ! 대체할 문자열에 문제가 있을 수 있다.

나의 경우는 터키어를 바꾸려고 했었는데, 지원이 안되는 것 같다. (Ö)

다른 문자열로 테스트해보니 잘됨 ㅎㅎ

유니코드나 치환처리를 해줘야 사용가능할 것 같다 ! 일단은 split으로 대체하여 사용해야겠다.

(삽질 오래했넹..)

https://stackoverflow.com/questions/37510650/how-can-i-replace-unicode-characters-with-turkish-characters-in-a-text-file-with

 

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

 

'Development > Python' 카테고리의 다른 글

[MySQL] 주별로 쿼리 조회  (0) 2023.04.12
[Python] lxml 설치  (0) 2023.03.06
[Python] undetected_chromedriver 오류 해결  (0) 2023.02.22
[Python] ERROR: command errored out with exit status 1 오류  (0) 2023.02.06
[Python] centos6/7에 python3.7.9 설치 하기  (0) 2023.01.30
'Development/Python' 카테고리의 다른 글
  • [MySQL] 주별로 쿼리 조회
  • [Python] lxml 설치
  • [Python] undetected_chromedriver 오류 해결
  • [Python] ERROR: command errored out with exit status 1 오류
곽진돔
곽진돔
Developer
  • 곽진돔
    echo "곽박한 세상";
    곽진돔
  • 전체
    오늘
    어제
    • 분류 전체보기 (184)
      • Development (57)
        • Linux (13)
        • k8s (3)
        • Docker (5)
        • AWS (1)
        • PHP (35)
        • Python (21)
        • Java (1)
        • SpringBoot (4)
        • JavaScript (1)
        • React (8)
        • MySql (19)
        • MongoDB (1)
      • Daily (4)
      • Study (6)
        • TIL (1)
        • license (3)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
    • 글쓰기
    • 설정
  • 링크

    • github
  • 공지사항

  • 인기 글

  • 태그

    JavaScript
    Python
    Java
    react
    Selenium
    date
    MySQL
    리액트
    인코딩
    chromedriver
    nodejs
    ssh
    크롤링
    윈도우
    스프링부트
    db
    리눅스
    UTF8
    Shell
    Linux
    error
    HTML
    CentOS7
    SQL
    springboot
    docker
    CentOS
    php
    정규표현식
    IP
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
곽진돔
[Python] replace가 안될 때
상단으로

티스토리툴바