Python程序可打印今天的年,月和日
生活随笔
收集整理的這篇文章主要介紹了
Python程序可打印今天的年,月和日
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
In the below example – we are implementing a python program to print the current/ today's year, month and year.
在下面的示例中-我們正在實現一個python程序來打印當前/今天的年,月和年 。
Steps:
腳步:
Import the date class from datetime module
從datetime模塊導入日期類
Create a date object of today's date – call the today() function of date class to get the current date.
創建今天日期的日期對象–調用date類的today()函數以獲取當前日期。
By using the date object – we can extract and print today's year, month and day.
通過使用日期對象,我們可以提取和打印今天的年,月和日。
Output
輸出量
Current date: 2020-03-09 Current year: 2020 Current month: 3 Current day: 9翻譯自: https://www.includehelp.com/python/program-to-print-todays-year-month-and-day.aspx
總結
以上是生活随笔為你收集整理的Python程序可打印今天的年,月和日的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 归来的福丹芝剧情介绍
- 下一篇: 泰诺多少钱啊?