프로그래밍

Python 한글 도메인 punycode 변환

warpmemory 2020. 3. 7. 15:13
>>> print "한글도메인.com".decode('utf-8').encode('idna')
xn--bj0bj3i97fq8o5lq.com
>>> print "xn--bj0bj3i97fq8o5lq.com".decode('idna').encode('utf-8')
한글도메인.com

외부 명령어나, 다른 모듈 필요 없이 idna 인/디코딩으로 변환할 수 있습니다.