标签: python
我正在尝试向CSVreader对象添加属性:
import csv csvfile = open(inputfilepath, 'rb') csv_reader = csv.reader(csvfile, delimiter=',', quotechar='"') setattr(csv_reader, 'nrows', countRows(csvfile))
收到此错误:
AttributeError:'_ csv.reader'对象没有属性'nrows'