8/25 목 ft. OpenSSH Key
1. 파일 관리 pickle: python 객체를 binary로 직렬화하여 파일로 저장 open(파일명, 모드): 열기. 사용 후 close()를 통해 리소스 릴리즈 모드: w, r, rb(이진 파일 읽기 전용), wb(이진 파일 쓰기 전용) >> open(‘file.txt’, ‘w’) 결과 : with: 특정 객체를 획득, 사용, 반납하는 경우 사용. with 구문을 빠져나가면 자동으로 리소스 릴리즈 >> with open(‘test.txt’, ‘r’) as f: >> f.read() write(): 쓰기 >> with open(‘file.txt’, ‘w’) as f: >> f.write(‘테스트 파일‘) pickle.dump: 쓰기 >> with open(‘file.pkl’, ‘wb’) as f: >..
더보기