小编Hus*_*leh的帖子

输入文件名作为字符串并返回字典

我有这个功能:

def make_happiness_table("word-happiness.csv"):
   ''' make_happiness_table: string -> dict
      creates a dictionary of happiness scores from the given file '''

   return {}
Run Code Online (Sandbox Code Playgroud)

但是在尝试运行程序时我一直遇到语法错误.

File "happiness.py", line 13
def make_happiness_table("word-happiness.csv"):
                                            ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

python string filenames dictionary

1
推荐指数
1
解决办法
127
查看次数

标签 统计

dictionary ×1

filenames ×1

python ×1

string ×1