第 3 步:现在让我们开始使用我们导入的 datetime 模块!每当您在代码中看到datetimedt时,您就在使用该模块。它允许 Python 程序访问您计算机上的确切日期和时间。

  • 在主题中,转到并将Current Datetime拖到主函数的底部。
  • current_datetime更改为my_datetime ,包括在 print 语句中。
  • 点击运行然后点击控制台按钮,看看打印出什么信息!

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)