Easy
w Replaces the File
Write
old text to f.txt. Then open it again in 'w' mode and write the input line. Print the file's contents: only the new text is left.Input
One line.
Output
One line.
Sample 1
Input
new text
Output
new text
Sample 2
Input
hello
Output
hello
Output appears here