[python] 파일 입출력 코드/예제

    [python] 파일 입출력 코드/예제

    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(l..