STEP 4:我们可以看到未格式化的日期时间包含了很多信息,但是我们想单独看到日期。

在 Python 中,特殊符号用于格式化日期时间对象的日期和时间。每个符号前面都有% 。要格式化月份,您可以在 strftime() 命令中使用%m 。几天,使用%d

  • .拖动Date Format - 12/31/19main()函数底部缩进。
  • 点击运行然后点击控制台按钮查看格式化日期!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)