최근 수정 시각 : 2024-06-03 22:57:35

Python/문법/모듈


파일:상위 문서 아이콘.svg   상위 문서: Python/문법
프로그래밍 언어 문법
{{{#!wiki style="margin: -16px -11px; word-break: keep-all"<colbgcolor=#0095c7><colcolor=#fff,#000> 언어 문법 C(포인터) · C++(자료형 · 클래스 · 이름공간 · 상수 표현식 · 특성) · C# · Java · Python · Kotlin · MATLAB · SQL · PHP · JavaScript
마크업 문법 HTML · CSS
개념과 용어 함수 · 인라인 함수 · 고차 함수 · 람다식 · 리터럴 · size_t · 상속 · 예외 · 조건문 · 참조에 의한 호출 · eval
기타 == · === · NaN · null · undefined · 모나드 · 배커스-나우르 표기법
프로그래밍 언어 예제 · 목록 · 분류 }}}

1. 개요2. 표준 라이브러리 모듈
2.1. 텍스트 처리 서비스2.2. 바이너리 데이터 서비스2.3. 데이터형2.4. 숫자와 수학 모듈2.5. 함수형 프로그래밍 모듈2.6. 파일과 디렉터리 액세스2.7. 데이터 지속성2.8. 데이터 압축 및 보관2.9. 파일 형식2.10. 암호화 서비스2.11. 일반 운영 체제 서비스2.12. 동시 실행2.13. 네트워킹과 프로세스 간 통신2.14. 인터넷 데이터 처리2.15. 구조화된 마크업 처리 도구2.16. XML 처리 모듈2.17. 인터넷 프로토콜과 지원2.18. 멀티미디어 서비스2.19. 국제화2.20. 프로그램 프레임워크2.21. Tk를 사용한 그래픽 사용자 인터페이스2.22. 개발 도구2.23. 디버깅과 프로파일링2.24. 소프트웨어 패키징 및 배포2.25. 파이썬 실행시간 서비스2.26. 사용자 정의 파이썬 인터프리터2.27. 모듈 임포트 하기2.28. 파이썬 언어 서비스2.29. MS 윈도우 특정 서비스2.30. 유닉스 특정 서비스2.31. Modules command-line interface (CLI)2.32. 대체된 모듈

1. 개요

Python모듈를 정리하는 문서.

2. 표준 라이브러리 모듈

Python 표준 라이브러리에서 제공하는 모듈은 다음과 같다. #

2.1. 텍스트 처리 서비스

  • string — Common string operations
  • re — Regular expression operations
  • difflib — Helpers for computing deltas
  • textwrap — Text wrapping and filling
  • unicodedata — Unicode Database
  • stringprep — Internet String Preparation
  • readline — GNU readline interface
  • rlcompleter — Completion function for GNU readline

2.2. 바이너리 데이터 서비스

  • struct — Interpret bytes as packed binary data
  • codecs — Codec registry and base classes

2.3. 데이터형

  • datetime — Basic date and time types
  • zoneinfo — IANA time zone support
  • calendar — General calendar-related functions
  • collections — Container datatypes
  • collections.abc — Abstract Base Classes for Containers
  • heapq — Heap queue algorithm
  • bisect — Array bisection algorithm
  • array — Efficient arrays of numeric values
  • weakref — 약한 참조
  • types — Dynamic type creation and names for built-in types
  • copy — Shallow and deep copy operations
  • pprint — Data pretty printer
  • reprlib — Alternate repr() implementation
  • enum — Support for enumerations
  • graphlib — Functionality to operate with graph-like structures

2.4. 숫자와 수학 모듈

  • numbers — Numeric abstract base classes
  • math — Mathematical functions
  • cmath — Mathematical functions for complex numbers
  • decimal — Decimal fixed point and floating point arithmetic
  • fractions — Rational numbers
  • random — Generate pseudo-random numbers
  • statistics — Mathematical statistics functions

2.5. 함수형 프로그래밍 모듈

  • itertools — Functions creating iterators for efficient looping
  • functools — Higher-order functions and operations on callable objects
  • operator — Standard operators as functions

2.6. 파일과 디렉터리 액세스

  • pathlib — Object-oriented filesystem paths
  • os.path — Common pathname manipulations
  • fileinput — Iterate over lines from multiple input streams
  • stat — Interpreting stat() results
  • filecmp — File and Directory Comparisons
  • tempfile — Generate temporary files and directories
  • glob — Unix style pathname pattern expansion
  • fnmatch — Unix filename pattern matching
  • linecache — Random access to text lines
  • shutil — High-level file operations

2.7. 데이터 지속성

  • pickle — Python object serialization
  • copyreg — Register pickle support functions
  • shelve — Python object persistence
  • marshal — Internal Python object serialization
  • dbm — Interfaces to Unix “databases”
  • sqlite3 — DB-API 2.0 interface for SQLite databases

2.8. 데이터 압축 및 보관

  • zlib — Compression compatible with gzip
  • gzip — Support for gzip files
  • bz2 — Support for bzip2 compression
  • lzma — Compression using the LZMA algorithm
  • zipfile — Work with ZIP archives
  • tarfile — Read and write tar archive files

2.9. 파일 형식

  • csv — CSV File Reading and Writing
  • configparser — Configuration file parser
  • tomllib — Parse TOML files
  • netrc — netrc file processing
  • plistlib — Generate and parse Apple .plist files

2.10. 암호화 서비스

  • hashlib — Secure hashes and message digests
  • hmac — Keyed-Hashing for Message Authentication
  • secrets — Generate secure random numbers for managing secrets

2.11. 일반 운영 체제 서비스

  • os — Miscellaneous operating system interfaces
  • io — Core tools for working with streams
  • time — Time access and conversions
  • argparse — Parser for command-line options, arguments and sub-commands
  • getopt — C-style parser for command line options
  • logging — Logging facility for Python
  • logging.config — Logging configuration
  • logging.handlers — Logging handlers
  • getpass — Portable password input
  • curses — Terminal handling for character-cell displays
  • curses.textpad — curses 프로그램을 위한 텍스트 입력 위젯
  • curses.ascii — Utilities for ASCII characters
  • curses.panel — A panel stack extension for curses
  • platform — Access to underlying platform’s identifying data
  • errno — Standard errno system symbols
  • ctypes — A foreign function library for Python

2.12. 동시 실행

  • threading — Thread-based parallelism
  • multiprocessing — Process-based parallelism
  • multiprocessing.shared_memory — Shared memory for direct access across processes
  • The concurrent package
  • concurrent.futures — Launching parallel tasks
  • subprocess — Subprocess management
  • sched — Event scheduler
  • queue — A synchronized queue class
  • contextvars — Context Variables
  • _thread — Low-level threading API

2.13. 네트워킹과 프로세스 간 통신

  • asyncio — Asynchronous I/O
  • socket — Low-level networking interface
  • ssl — TLS/SSL wrapper for socket objects
  • select — Waiting for I/O completion
  • selectors — High-level I/O multiplexing
  • signal — Set handlers for asynchronous events
  • mmap — Memory-mapped file support

2.14. 인터넷 데이터 처리

  • email — An email and MIME handling package
  • json — JSON encoder and decoder
  • mailbox — Manipulate mailboxes in various formats
  • mimetypes — Map filenames to MIME types
  • base64 — Base16, Base32, Base64, Base85 Data Encodings
  • binascii — Convert between binary and ASCII
  • quopri — Encode and decode MIME quoted-printable data

2.15. 구조화된 마크업 처리 도구

  • html — HyperText Markup Language support
  • html.parser — Simple HTML and XHTML parser
  • html.entities — Definitions of HTML general entities

2.16. XML 처리 모듈

  • xml.etree.ElementTree — The ElementTree XML API
  • xml.dom — The Document Object Model API
  • xml.dom.minidom — Minimal DOM implementation
  • xml.dom.pulldom — Support for building partial DOM trees
  • xml.sax — Support for SAX2 parsers
  • xml.sax.handler — Base classes for SAX handlers
  • xml.sax.saxutils — SAX Utilities
  • xml.sax.xmlreader — Interface for XML parsers
  • xml.parsers.expat — Fast XML parsing using Expat

2.17. 인터넷 프로토콜과 지원

  • webbrowser — Convenient web-browser controller
  • wsgiref — WSGI Utilities and Reference Implementation
  • urllib — URL handling modules
  • urllib.request — Extensible library for opening URLs
  • urllib.response — urllib가 사용하는 응답 클래스
  • urllib.parse — Parse URLs into components
  • urllib.error — Exception classes raised by urllib.request
  • urllib.robotparser — Parser for robots.txt
  • http — HTTP modules
  • http.client — HTTP protocol client
  • ftplib — FTP protocol client
  • poplib — POP3 protocol client
  • imaplib — IMAP4 protocol client
  • smtplib — SMTP protocol client
  • uuid — UUID objects according to RFC 4122
  • socketserver — A framework for network servers
  • http.server — HTTP servers
  • http.cookies — HTTP state management
  • http.cookiejar — Cookie handling for HTTP clients
  • xmlrpc — XMLRPC server and client modules
  • xmlrpc.client — XML-RPC client access
  • xmlrpc.server — Basic XML-RPC servers
  • ipaddress — IPv4/IPv6 manipulation library

2.18. 멀티미디어 서비스

  • wave — Read and write WAV files
  • colorsys — Conversions between color systems

2.19. 국제화

  • gettext — Multilingual internationalization services
  • locale — Internationalization services

2.20. 프로그램 프레임워크

  • turtle — 터틀 그래픽
  • cmd — Support for line-oriented command interpreters
  • shlex — Simple lexical analysis

2.21. Tk를 사용한 그래픽 사용자 인터페이스

  • tkinter — Python interface to Tcl/Tk
  • tkinter.colorchooser — Color choosing dialog
  • tkinter.font — Tkinter font wrapper
  • Tkinter 대화 상자
  • tkinter.messagebox — Tkinter message prompts
  • tkinter.scrolledtext — Scrolled Text Widget
  • tkinter.dnd — Drag and drop support
  • tkinter.ttk — Tk themed widgets
  • tkinter.tix — Extension widgets for Tk
  • IDLE

2.22. 개발 도구

  • typing — 형 힌트 지원
  • pydoc — Documentation generator and online help system
  • 파이썬 개발 모드
  • doctest — Test interactive Python examples
  • unittest — Unit testing framework
  • unittest.mock — mock object library
  • unittest.mock — getting started
  • 2to3 — Automated Python 2 to 3 code translation
  • test — Regression tests package for Python
  • test.support — 파이썬 테스트 스위트용 유틸리티
  • test.support.socket_helper — 소켓 테스트용 유틸리티
  • test.support.script_helper — 파이썬 실행 테스트용 유틸리티
  • test.support.bytecode_helper — 올바른 바이트 코드 생성 테스트를 위한 지원 도구
  • test.support.threading_helper — Utilities for threading tests
  • test.support.os_helper — Utilities for os tests
  • test.support.import_helper — Utilities for import tests
  • test.support.warnings_helper — Utilities for warnings tests

2.23. 디버깅과 프로파일링

  • 감사 이벤트 표
  • bdb — Debugger framework
  • faulthandler — Dump the Python traceback
  • pdb — 파이썬 디버거
  • 파이썬 프로파일러
  • timeit — Measure execution time of small code snippets
  • trace — Trace or track Python statement execution
  • tracemalloc — Trace memory allocations

2.24. 소프트웨어 패키징 및 배포

  • ensurepip — Bootstrapping the pip installer
  • venv — Creation of virtual environments
  • zipapp — Manage executable Python zip archives

2.25. 파이썬 실행시간 서비스

  • sys — System-specific parameters and functions
  • sys.monitoring — Execution event monitoring
  • sysconfig — Provide access to Python’s configuration information
  • builtins — Built-in objects
  • main — Top-level code environment
  • warnings — Warning control
  • dataclasses — Data Classes
  • contextlib — with 문 컨텍스트를 위한 유틸리티
  • abc — Abstract Base Classes
  • atexit — Exit handlers
  • traceback — Print or retrieve a stack traceback
  • future — Future statement definitions
  • gc — Garbage Collector interface
  • inspect — Inspect live objects
  • site — Site-specific configuration hook

2.26. 사용자 정의 파이썬 인터프리터

  • code — Interpreter base classes
  • codeop — Compile Python code

2.27. 모듈 임포트 하기

  • zipimport — Import modules from Zip archives
  • pkgutil — Package extension utility
  • modulefinder — Find modules used by a script
  • runpy — Locating and executing Python modules
  • importlib — import의 구현
  • importlib.resources – Package resource reading, opening and access
  • importlib.resources.abc – Abstract base classes for resources
  • importlib.metadata – Accessing package metadata
  • The initialization of the sys.path module search path

2.28. 파이썬 언어 서비스

  • ast — Abstract Syntax Trees
  • symtable — Access to the compiler’s symbol tables
  • token — Constants used with Python parse trees
  • keyword — Testing for Python keywords
  • tokenize — Tokenizer for Python source
  • tabnanny — Detection of ambiguous indentation
  • pyclbr — Python module browser support
  • py_compile — Compile Python source files
  • compileall — Byte-compile Python libraries
  • dis — Disassembler for Python bytecode
  • pickletools — Tools for pickle developers

2.29. MS 윈도우 특정 서비스

  • msvcrt — Useful routines from the MS VC++ runtime
  • winreg — Windows registry access
  • winsound — Sound-playing interface for Windows

2.30. 유닉스 특정 서비스

  • posix — The most common POSIX system calls
  • pwd — The password database
  • grp — The group database
  • termios — POSIX style tty control
  • tty — Terminal control functions
  • pty — Pseudo-terminal utilities
  • fcntl — The fcntl and ioctl system calls
  • resource — Resource usage information
  • syslog — Unix syslog library routines

2.31. Modules command-line interface (CLI)

2.32. 대체된 모듈

  • aifc — AIFF와 AIFC 파일 읽고 쓰기
  • audioop — Manipulate raw audio data
  • cgi — Common Gateway Interface support
  • cgitb — CGI 스크립트를 위한 트레이스백 관리자
  • chunk — IFF 청크된 데이터 읽기
  • crypt — 유닉스 비밀번호 확인 함수
  • imghdr — 이미지 유형 판단
  • mailcap — Mailcap 파일 처리
  • msilib — Read and write Microsoft Installer files
  • nis — Sun의 NIS(옐로 페이지)에 대한 인터페이스
  • nntplib — NNTP 프로토콜 클라이언트
  • optparse — Parser for command line options
  • ossaudiodev — Access to OSS-compatible audio devices
  • pipes — 셸 파이프라인에 대한 인터페이스
  • sndhdr — 음향 파일 유형 판단
  • spwd — 섀도 암호 데이터베이스
  • sunau — Sun AU 파일 읽고 쓰기
  • telnetlib — 텔넷 클라이언트
  • uu — uuencode 파일 인코딩과 디코딩
  • xdrlib — XDR 데이터 인코딩과 디코딩