第 2 步:现在我们的游戏正在运行,让我们开始创建第一个读取 CSV 文件的函数。

  • 这个函数需要一个参数:我们从中提取数据的文件的名称。
  • ,在上面写着: MAIN FUNCTION的地方拖入Define Function with Docstring
  • my_function重命名为get_high_scores并在( )中键入file_name
  • 最后,将您的文档字符串更改为以下内容: """ Returns data from CSV as list of lists """

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)