Answer to Question #80025 in Python for Desire Silas

Question #80025
when opening a file, the “wt” parameter indicated that we:


want to append to the end of the text file.



want to write data to a text file.


that we are opening a binrary file.


that we are reading from a text file.
1
Expert's answer
2018-08-22T12:55:08-0400
Answer: want to write data to a text file.

Example:

with open('example.txt', 'wt') as f:
f.write("Hello")

Python will look in the same folder that you have saved this Python document for a file called example.txt.
If it can’t find a file with this exact name then it creates it.
The ‘wt’ stands for ‘write to’ and means you want to open the file in ‘write mode’ to edit its contents.
This line f.write("Hello”) writes “Hello” to the file.

https://pynewbs.com/10a/a/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS