我需要找到从第 4 列到 CSV 文件末尾的第三行。我该怎么做?我知道我可以从第 4 列中找到值 行[3] 但是我如何才能得到第三行呢?
最佳答案
您可以将 csv 阅读器对象转换为列表列表...行存储在列表中,该列表包含列列表。
所以:
csvr = csv.reader(file)
csvr = list(csvr)
csvr[2] # The 3rd row
csvr[2][3] # The 4th column on the 3rd row.
csvr[-4][-3]# The 3rd column from the right on the 4th row from the end
关于python - 如何在 Python CSV 模块中查找特定行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30713181/