第 17 步:我们已准备好写入文件。这样做就像使用两个工具包块一样简单!

csv . writer( my_file )创建一个可以写入特定 CSV 文件的对象。

  • 在主题和,将Create Writer update_high_scores()
  • 然后,将Write Row to CSV下方和内部update _high_scores ()
  • 最后,让我们关闭我们的文件!将Close File拖到您的 for 循环下方。它应该只缩进4 个空格

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)