본문 바로가기
목차
Python

[Python] File Handling

by ds31x 2023. 12. 5.
728x90
반응형

File 열고 닫기.

2023.07.04 - [Python] - [Python] file : open and close

 

[Python] file: open and close

Python 에서 file을 처리하기 위해선 다른 프로그래밍 언어와 마찬가지로 file에 대한 접근이 가능한 object를 얻어와야함.이같은 object는 file object, file handler, file descriptor 등의 여러 이름으로 불리며,P

ds31x.tistory.com


Text file 처리

2023.07.04 - [Python] - [Python] Text File : read and write

 

[Python] Text File: read and write

Python에서 Text File을 읽고 쓰는 것은 io.TextIOWrapper 객체를 이용하며 문자 기반의 stream 으로 이루어짐.개행문자를 기반으로 flush가 이루어지는 line_buffering을 사용 가능함 (line_buffering=True 로 설정시).

ds31x.tistory.com


Binary file 처리

2023.07.04 - [Python] - [Python] binary file : write and read

 

[Python] binary file: write and read

binary file을 읽고 쓰는 건 text file을 읽고 쓰는 것과 유사하나, bytes 객체 들을 통해 이루어지며, 글자가 아닌 byte 단위를 사용한다는 점이 차이점임.0. Binary File이란Binary file은 데이터를텍스트 형식

ds31x.tistory.com


Text mode vs. Binary mode

2024.01.15 - [Python] - [python] Text mode vs. Binary mode: File open

 

[python] Text mode vs. Binary mode: File open

Python에서 특정 파일을 open하는 경우, text mode 또는 binary mode 중 하나로 열게 된다.기본은 text mode임. 이 둘의 차이점은 간단히 설명하면,현재 open하고자 하는 file을 text파일로 처리할지아니면 binary

ds31x.tistory.com


Binary File의 특별한 사용: pickle (Serialization)

2024.11.27 - [Python] - [Py] Serialization of Python: pickle

 

[Py] Serialization of Python: pickle

1. Python의 pickle 모듈Python의 pickle 모듈은 Python 객체를 직렬화(serialize)하여 파일 또는 메모리에 저장.저장된 데이터를 다시 역직렬화(deserialize)하여 원래 객체로 복원.데이터를 영구 저장하거나 네

ds31x.tistory.com


Binary File의 특별한 사용: struct 모듈 (기본일 때는 생략)

2024.01.15 - [Python] - [Python] `struct` 사용하기: bytes 로 C언어 구조체 다루기.

 

[Python] `struct` 사용하기: bytes 로 C언어 구조체 다루기.

struct 모듈binary data를 보다 쉽게 파싱해주는 기능을 제공한다. C언어의 구조체로 명시된 binary data를 네트워크 등으로 받은 경우나,binary format으로 특정 header정보를 가지고 있는 파일들을 읽어들

ds31x.tistory.com


Memory 기반 Stream: BytesIO & StringIO

2024.12.03 - [Python] - [Py] io.StringIO 와 io.BytesIO

 

[Py] io.StringIO 와 io.BytesIO

io.StringIO와 io.BytesIO는Python의 io 모듈에서 제공하는 메모리 기반 파일 객체(memory-based file object)임.이들은 데이터를 메모리에 저장하면서 파일처럼 다룰 수 있는 기능을 제공함: Stream Object두 클래

ds31x.tistory.com


File 및 Directory 처리 (Path 등에 대한)

2023.07.04 - [Python] - [Python] os 모듈의 함수들 : file과 directory 관련

 

[Python] os 모듈의 함수들 : file과 directory 관련

os 모듈의 함수들 : file과 directory 관련os는operating system (운영체제)와상호작용을 위한 다양한 기능을 제공하는built-in module임.대부분 os 종속적인 기능들이다.os.path 모듈ds_exist = os.path.exists('path')path

ds31x.tistory.com

2024.03.31 - [Python] - [Python] pathlib.Path 사용하기.

 

[Python] pathlib.Path 사용하기.

Path 클래스는 pathlib 모듈의 클래스 :file 및 directory의 path 를 객체지향적으로 취급하기 쉬운 인터페이스를 제공하는Python 표준 라이브러리임.Python 3.4 이상에서 사용가능함. 더보기2023.07.04 - [Python]

ds31x.tistory.com


 

 

 

728x90