有人能帮我解决这个错误吗?:TypeError: unhashable type: 'list'

时间:2021-04-07 17:48:28

标签: python-3.x

此图片中的代码产生错误。

enter image description here

1 个答案:

答案 0 :(得分:0)

试试这个:

changeValueWithMap(id: number) {
    array = array.map(item => {
      if (item.id === id) {
        return {
          ...item,
          exampleBoolean: true,
        }
      }
      return item;
    });
  }

此外,您正在拆分 for x in movies['genre'].tolist(): 。在您的示例中,我没有看到流派之间有任何空格。只有这个字符x.split(' | ')。但是,如果您希望它们之间有空格,则无需使用 |,即两侧的空格。只需使用 ' | '。如果不需要空格,则 '| '