Files

How to read and write files in Python.

Python
import os
import datetime

with open("today.txt", "w+") as file:
    file.write(datetime.datetime.now().strftime("%Y-%m-%d"))
Click Run or press shift + ENTER to run code.