urllib parse unquote
urllib.parse.unquote(string, encoding=βutf-8β, errors=βreplaceβ)
Replace%xx
escapes with their single-character equivalent. The optional encoding and errors parameters specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method.
from urllib.parse import unquote
img_name = unquote(img_name)
# before decode: %ED%95%A0%EB%8B%B9%EC%99%84%EB%A3%8C-t2804k8b(3)-%EC%9B%90%ED%8F%AC%EC%9D%B8%ED%8A%B8(%EC%83%98%ED%94%8C,%EB%A7%88%EA%B0%80%EB%A0%9BT)11.23-1-DSC_2674.jpg
# after decode: ν λΉμλ£-t2804k8b(3)-μν¬μΈνΈ(μν,λ§κ°λ T)11.23-1-DSC_2674.jpg
Leave a comment