> For the complete documentation index, see [llms.txt](https://haleyryu.gitbook.io/engineer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://haleyryu.gitbook.io/engineer/python/module/pickle.md).

# Pickle - 자료형을 파일로 저장할 때

### 언제 사용하나요?

* Text가 아닌 자료형을 파일로 저장할때 사용합니다.\
  ex. Class형, List형, etc

## Pickle 사용하기&#x20;

* Python 의 내장 모듈이므로 따로 설치가 필요없고 import 하여 사용합니다.
* [공식 문서 바로가기](https://docs.python.org/3/library/pickle.html)

### 입력&#x20;

#### 1. File 형태로 저장하기

* pickle.dump
* Spec : `pickle.dump(obj, file, protocol=None, *, fix_imports=True)`

```python
import pickle

list = ['a', 'b', 'c']
with open('list.txt', 'wb') as f:
    pickle.dump(list, f)
```
