我正在尝试从我正在加载的两个不同文件中获取匹配项 . 我得到一个AttribureError,说'unicode'对象没有属性'intersection' . 我不确定为什么会出现错误?
data_current = json.loads(current_data)
data_previous = json.loads(previous_data)
current_fn = data_current['File Name']
previous_fn = data_previous['File Name']
matches = current_fn.intersection(previous_fn)
# no_matches = current_fn.difference(previous_fn)
if matches:
print "matches"
else:
print "no matches"