I have a python script which takes input from a admin.csv file. I want to read the latest entry in the admin.csv file, which is on the last line. Kindly help me out. My csv file is below.

Input_IP    Skip_Frames Save_Video  Id_Display    100             True    False   91              False   True   1               True    True    11              False   False    99              True    True

2 Answers

Miklos Horvath On Best Solutions

The csv reader is a generator, you can convert that to a list. You can get the last data in the last line with the following code sample:

import csv

with open('test.csv') as csv_file:
    csv_reader = csv.reader(csv_file, delimiter=' ')
Chinni On

One simple way if you are using pandas is

import pandas as pd

df = pd.read_csv('filename.csv')