소프트웨어/python [python] 파일 입출력 코드/예제 개발자_이훈규 2015. 9. 9. 14:05 import sys argc = len(sys.argv) argv = str(sys.argv) # Print it print ("The total numbers of args passed to the scripts : %d" % argc) print ("Args list : %s" % argv) # Wrtie file fwrite = open("result.log", "w") for i in range(1, 11) : data = "%d line \n" %i fwrite.write(data) fwrite.close() # Read file fread = open(sys.argv[1], 'r') while True: line = fread.readline() if not line: break print(line) fread.close() 저작자표시 비영리 (새창열림)