기타툴 스크립트 open에 대한 질문입니다.
2010.01.08 00:10
---------------------------------------------------------------------------------------------------------------------
Opens file and returns a File object. mode specifies one of the following strings. When mode is omitted, the default is "r".
- "r": Opens file in read mode.
- "w": Opens file in write mode. If a file already exists when file is opened, the previous file's contents will be deleted.
- "a": Opens file in write mode. Output will always be appended to the end of the file.
Using "+" opens the file in read-write mode (RDWR):
"r+": Sets the read-write position to the beginning of the file.- "w+": The same as "r+", but if a file already exists when file is opened, the previous file's contents will be deleted.
- "a+": The same as "r+", but if a file already exists when file is opened, the read-write position will be set to the end of the file.
The "b" flag can also be added to any of these (in the format "r+b") to open the file in binary mode.
--------------------------------------------------------------------------------------------------------------------
대충 r은 읽기모드. w는 쓰기모드라는 건 알겠는데..
Q1. w와 a의 차이점.
Q2. +의 기능은? 안 붙이면 파일의 첫단부터 읽는거고 붙이면 마지막단부터읽는게 맞는지...
Q3. b는 ? 제한모드라는데 전혀 감을 못잡겠네요.