Home  »  CodeSnippets   »   How to Write a File in Python

How to Write a File in Python

Posted: February 6, 2022 | by Michael Bright

f= open("filename.txt", "w")

Open function is used to open the file. The first parameter is the file to open and the second parameter (w) makes the file writable.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.