Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- DATAPATH
- CSS
- XML
- DoM
- mysql
- system
- function
- html
- Pipelining
- DB
- DS
- Class
- Algorithm
- MIPS
- Linux
- react
- github
- while
- control
- for
- python
- Java
- architecture
- php
- data structure
- instruction
- web
- computer
- javascript
- MacOS
Archives
- Today
- Total
목록write (1)
YYYEJI
[Python] 파일 다루기
파일 다루기(File handling)를 해보겠습니다. 파일 열기 읽기 형식으로 파일 열기 file = open("f.txt", "rt") 쓰기 형식으로 파일 열기 file = open("f.txt", "wt") r - read (파일의 내용을 읽을 때 사용) w - write (파일에 내용을 쓸 때 사용) a - append (파일에 내용을 덧붙일 때 사용) x - create (파일 생성, 원래 존재하면 에러 메세지 return) t - text b - binary 파일 쓰기 파일에 글을 쓸 때는 "wt"로 파일을 열어야하고 아래와 같이 파일에 작성할 수 있습니다. file.write("Hi there~\n") file.write("Welcome to My Blog") ↑↑↑ 한 줄씩 쓰기 ↑↑↑ f..
Python
2022. 11. 19. 22:44