// education

파이썬 핵심 표준 라이브러리 (math, random, datetime, json, re)

"Batteries Included"라는 파이썬의 명성답게 파이썬 기본 설치 시 동봉되는 필수 표준 라이브러리 모듈들을 학습합니다.


1. 표준 라이브러리 용어 사전 (Glossary)


2. json 및 re 정규표현식 실습

import json
import re

# JSON 직렬화 & 파싱
data = {"title": "DAVHAVE 파이썬", "lessons": 46, "is_active": True}
json_str = json.dumps(data, ensure_ascii=False, indent=2)
parsed_dict = json.loads(json_str)

print(f"JSON 직렬화 텍스트:
{json_str}")

# 정규 표현식 이메일 추출
text = "문의 사항은 support@davhave.com 또는 admin@test.co.kr 로 보내주세요."
email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}'
emails = re.findall(email_pattern, text)
print(f"추출된 이메일 목록: {emails}")
← 이전이터레이터(Iterator), yield 제너레이터(Generator)와 데코레이터(Decorator) 다음 →tkinter를 활용한 파이썬 데스크톱 GUI 프로그래밍