본문 바로가기

공부/Python

python 파일 모드

반응형
  • r for reading
  • r+ opens for reading and writing (cannot truncate a file)
  • w for writing
  • w+ for writing and reading (can truncate a file)
  • rb for reading a binary file. The file pointer is placed at the beginning of the file.
  • rb+ reading or writing a binary file
  • wb+ writing a binary file
  • a+ opens for appending
  • ab+ Opens a file for both appending and reading in binary. The file pointer is at the end of the file if the file exists. The file opens in the append mode.
  • x open for exclusive creation, failing if the file already exists (Python 3)
반응형

'공부 > Python' 카테고리의 다른 글

11. [Python] print 기본 사용  (0) 2020.03.31
10. [Python] ini 설정값 (configparser)  (0) 2020.02.20
오류 노트  (0) 2020.01.21
9. [Python] ipynb 파일 py로 변환하기  (0) 2020.01.03
7. [Python] 자료 구조 - list, tuple, dict  (1) 2019.12.20