尝试模拟计数器,获取类型错误:“str”对象不是callab

2024-06-02 20:47:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在寻找基于多个密钥的重复记录。我使用的是python2.5,所以不能使用Counter。我正在更改代码以获得所需的结果,但我得到了TypeError: 'str' object is not callable。在

start ="0,1,2,3"
mylist= [int(x) for x in start.split(',')]
key = itemgetter(*mylist)
file2 = open('temp_src.csv','rb')
f=[]
for row in file2:
   if row(key) not in f: error 
      f.append(row)

Tags: key代码inforobjectcounter密钥not