我根据你的建议尝试了以下脚本,我得到一个错误导入csv
def main():
col_name = "\\xyz-abc\Procz(abcd)\Digital"
with open('C:\\read.csv', 'rb') as inf:
reader = csv.reader(inf)
col_index = next(reader).index(col_name)
highest = max(rec[col_index] for rec in reader)
print "test"
main()
我收到错误ValueError: '\\\\xyz-abc\Procz(abcd)\Digital' is not in list
请帮帮我..
我认为脚本没有读取列标题。
答案 0 :(得分:2)
放手一搏。使用原始字符串
防止反斜杠被解释为转义字符col_name = r"\\xyz-abc\Procz(abcd)\Digital"