OSError: [Errno 9] Bad file descriptor
def get_pairs(sel f,pairs_path):
with open(pairs_path, 'r') as f: # qqqq
pairs = [l.split() for l in f.readlines()]
f.close()
return pairs
函数写在数据集加载的类的__init__()和__getitem__()里,主要就是一段读取.txt文件的代码,在
with open(pairs_path, 'r') as f: # qqqq