Python/Python Programming

[Python] Access Log 유니코드를 한글로 변환

Pydole 2019. 4. 18. 19:02

access log 파일이나 한글 URL경로를 보면 한글이 유니코드로 표기되어 있다. python으로 이를 한글로 쉽게 변환이

가능하다. 

 

from urllib.parse import unquote_plus

site = '.com/%EA%B3%A0%EB%93%B1-%EC%98%81%EC%96%B4'
searchword = unquote_plus(site, encoding='utf-8', errors='replace')
print(searchword)
-------------------------------------------------------------------
.com/고등-영어