I want to open a file for reading and writing ?

Submitted 3 years, 6 months ago
Ticket #230
Views 215
Language/Framework Python
Priority Medium
Status Closed

Could you please tell me a way in python to open a file for both reading and writing......

Thanks in advance...

Submitted on Oct 13, 20
sai
add a comment

1 Answer

Verified

f= open("sample.txt","w+")

Here, we used "w" letter in our argument, which indicates write and will create a file if it does not exist in library

Plus sign indicates both read and write.

 

Submitted 3 years, 6 months ago


Latest Blogs