Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
current year in python 1

current year in python

June 12, 2022 by Anurag batra
import datetime
now = datetime.datetime.now().year
print(now)

Here is what the above code is Doing:
1. We import the datetime module.
2. We create a variable called now and set it equal to datetime.datetime.now().year.
3. We print the value of now.

Categories Python Examples
Post navigation
function with default values for the arguments in python
display text in pygame
© MyEduKit - 2022 . All Rights Reserved.