113k views
0 votes
Which answer below will open a file called "textfile.txt" and overwrite the content contained within?

f = open('textfile.txt', 'a+')

f = open(textfile.txt', 'r+')

f = open('textfile.txt', 'w+')

f = open('textfile.txt', 'n+')

User Kugel
by
7.9k points

1 Answer

1 vote

The answer is f = open('textfile.txt', 'w+')

User Alexandra
by
7.4k points