第 9 步:要查看当前时间,我们需要 datetime 对象中的小时。

Datetime 对象是一种特殊的 Python 数据类型。它们具有我们可以使用datetime . hourdatetime . datedatetime . time

  • 在主题中,转到并拖出Hour使其缩进到main()函数的底部。

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)