To find the current date in Python, we have to use the date
module from the Python's datetime
library.
Here is an example code snippet that shows how to get the current date in Python:
main.py118 chars7 lines
The output of this code will be something like:
main.py28 chars2 lines
In this example, we import the datetime
module, which is a standard Python library for working with dates and times.
Then we call the date.today()
method to get the current date, and store it in the current_date
variable. Finally, we print the current date to the console using the print()
function.
gistlibby LogSnag