write and with print, then reads the whole file back. It prints nothing on the screen.
with open("out.txt", "w") as f:
n = f.write("ab\n")
print("cd", "ef", sep="-", file=f)
with open("out.txt") as f:
text = f.read()
Which of these give True after the code? Choose every correct option.One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.
Log in to join the discussion.
Loading…