파이썬 python 파일 읽기 쓰기 read write 간단 구현


파이썬 python 파일 읽기 쓰기 read write 간단 구현

파일 읽기 filename = "sample.txt" # Read the contents of the file with open(filename, "r") as file: contents = file.read() print("Original contents:") print(contents) 파일 쓰기 # Modify the contents of the file contents = contents.upper() # Write the modified contents to the file with open(filename, "w") as file: file.write(contents) # Read the modified contents of the file with open(filename, "r") as f..


원문링크 : 파이썬 python 파일 읽기 쓰기 read write 간단 구현