Search Results

Search found 1 results on 1 pages for 'user2341103'.

Page 1/1 | 1 

  • printing only the last 8 entries in a .csv file

    - by user2341103
    I have an input csv file as below,I want to print only the most recent 8 entries..can anyone provide inputs on how to do this? INPUT:- trend.csv ['2013-06-25 20:01', '10'] ['2013-06-25 20:06', '9'] ['2013-06-25 20:06', '8'] ['2013-06-26 20:06', '7'] ['2013-06-26 20:06', '6'] ['2013-06-26 20:06', '5'] ['2013-06-26 20:06', '4'] ['2013-06-26 20:06', '3'] ['2013-06-26 20:06', '2'] ['2013-06-26 20:08', '1'] OUTPUT:- ['2013-06-25 20:06', '8'] ['2013-06-26 20:06', '7'] ['2013-06-26 20:06', '6'] ['2013-06-26 20:06', '5'] ['2013-06-26 20:06', '4'] ['2013-06-26 20:06', '3'] ['2013-06-26 20:06', '2'] ['2013-06-26 20:08', '1'] import csv #Now read the recent 8 entries and print cr = csv.reader(open("trend.csv","rb")) for row in cr: #print only the recent most 8 entries print row

    Read the article

1