import os file = open("temp", "w") file.write("before the fork") # 15 #file.flush() if os.fork() == 0: # in the child print("child: {}".format(file.tell())) print("child: {}".format(file.tell())) else: # in the parent print("parent: {}".format(file.tell())) print("parent: {}".format(file.tell())) file.close()