How to read and write file in python


How to read and write file in python

파이썬 파일 읽기

import os
f = open("filename.txt", "r")
f.read()
f.close()

파이썬 파일 쓰기

h = "HELLO WORLD"
f = open("filename.txt", "w")
f.write(h)
f.close()

댓글