{"id":11842,"date":"2022-02-06T15:58:01","date_gmt":"2022-02-06T20:58:01","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=11842"},"modified":"2022-02-06T16:42:27","modified_gmt":"2022-02-06T21:42:27","slug":"how-to-write-a-file-in-python","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/how-to-write-a-file-in-python\/","title":{"rendered":"How to Write a File in Python"},"content":{"rendered":"\n
f= open("filename.txt", "w")\nf.write("hello")\nf.close()<\/code><\/pre>\n\n\n\nOpen function is used to open the file. The first parameter is the file to open and the second parameter (w) makes the file writable.<\/p>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,15],"tags":[954,471,475],"yoast_head":"\n
Python How to Write a File - Brightwhiz.com<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n