Convert Korean ZIP code to address
Project description
KoZIP
Python library for converting Korean ZIP code to address
우편번호를 (도로명)주소로 변환해 주는 파이썬 라이브러리입니다. 현 우편번호(5자리), 구 우편번호(6자리) 모두 사용 가능합니다.
본 라이브러리는 우체국 홈페이지에 고시된 정보를 바탕으로 만들어졌습니다.
| 우편번호 | 고시일자 | 다운로드 링크 |
|---|---|---|
| 현 우편번호 (5자리) | 2021.11.03. | 다운로드 |
| 구 우편번호 (6자리) | 2015.08.27. | 다운로드 |
Quick Start
from kozip import KoZIP
kozip = KoZIP()
kozip.ZIPtoAddr("08826", depth="full")
# 출력 :
# ['서울특별시 관악구 관악로 1 (신림동)']
kozip.ZIPtoAddr("16419", depth="full")
# 출력 :
# ['경기도 수원시 장안구 서부로 2066 (천천동)',
# '경기도 수원시 장안구 일월로90번길 19 (천천동)',
# '경기도 수원시 장안구 일월로90번길 7 (천천동)']
Environment
- Python 3 이상
How to install
pip install kozip
Methods
KoZIP.ZIPtoAddr(zipcode, depth, format)
우편번호를 입력받아 주소로 변환하는 메소드
-
zipcode: 우편번호- 현 우편번호(5자리), 구 우편번호(6자리) 모두 사용 가능
- 문자열 형태(
str)로 입력해도 되고, 숫자 형태(int)로 입력해도 된다(단, 0으로 시작하는 우편번호는 숫자 형식으로 입력할 수 없다). - 구 우편번호의 경우, "123-456", "123456" 형태로 모두 사용 가능
-
depth: [Optional(default:2)] 출력될 주소의 깊이depth 사용 가능한 값 설명 1 1,"1","시도"시도 단위까지 출력 2 2,"2","시군구"시군구 단위까지 출력. 기본값 3 3,"3","도로명"도로명 단위까지 출력 4 4,"4","full"도로명 단위에 추가 정보(읍면동, 리 정보)까지 출력 -
format: [Optional(default:"string")] 출력 형식format 사용 가능한 값 설명 문자열 "string" 문자열 형태로 출력. 기본값 리스트 "list" ( depth값과 같은 길이의) 리스트 형태로 출력
| format | |||
|---|---|---|---|
| 문자열 | 리스트 | ||
| depth | 1 | |
|
| 2 | |
|
|
| 3 | |
|
|
| 4 | |
|
KoZIP.maskedZIPtoAddr(masked_zipcode, masked_letter, depth, format)
마스킹 처리된 우편번호를 입력받아 주소로 변환하는 메소드
-
masked_zipcode: 마스킹 처리된 우편번호- 현 우편번호(5자리)만 사용 가능
- 길이 5인 문자열 형태(
str)로만 입력해야 함 - 오직 한 종류의 마스킹 문자(
masked_letter)로만 마스킹 되어있어야 함
-
masking_letter: [Optional(default:*)] 마스킹 문자- 길이 1인 문자열 형태로 입력해야 함
-
depth: [Optional(default:1)] 출력될 주소의 깊이depth 사용 가능한 값 설명 1 1,"1","시도"시도 단위까지 출력 2 2,"2","시군구"시군구 단위까지 출력. 기본값 3 3,"3","도로명"도로명 단위까지 출력 4 4,"4","full"도로명 단위에 추가 정보(읍면동, 리 정보)까지 출력 -
format: [Optional(default:"string")] 출력 형식format 사용 가능한 값 설명 문자열 "string" 문자열 형태로 출력. 기본값 리스트 "list" ( depth값과 같은 길이의) 리스트 형태로 출력
from kozip import KoZIP
kozip = KoZIP()
kozip.maskedZIPtoAddr("08***")
# 출력 :
# ['서울특별시']
kozip.maskedZIPtoAddr("164??", masking_letter="?", depth=2, format="list")
# 출력 :
# [ ['경기도', '수원시 권선구'],
# ['경기도', '수원시 팔달구'],
# ['경기도', '수원시 영통구'],
# ['경기도', '수원시 장안구'] ]
kozip.maskedZIPtoAddr("x0x01", masking_letter="x")
# 출력 :
# ['경기도', '경상남도', '세종특별자치시', '경상북도']
Changelog
v1.0
- 최초 버전
KoZIP.ZIPtoAddr(zipcode, depth, format)메서드 추가
v1.1
KoZIP.maskedZIPtoAddr(masked_zipcode, masked_letter, depth, format)메서드 추가- Lazy Loading 구현
- 이제 실제 데이터를 사용할 때 데이터를 로드함
- 사용하지 않는 데이터까지 모두 로드하지 않아, 객체 생성 속도가 빨라짐
- 배포 자동화 스크립트
commit생성
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kozip-1.1.4-py3-none-any.whl.
File metadata
- Download URL: kozip-1.1.4-py3-none-any.whl
- Upload date:
- Size: 44.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36b43c07219473454d42319b5361b057078b006bfd8348e5b9e9d1f1eb8482e7
|
|
| MD5 |
3ec4a069192569f6d1f6ab95baf71667
|
|
| BLAKE2b-256 |
58017d56503fa9f03ebde011e5a337aeca383aa6da74a7ba2582529c115a2f9f
|