Reading csv file

Jan 29, 2014 at 8:47am
hi, how do i search a csv file?.
I have a table with 3 columns (Employee ID , salary ,grade ) If i will enter an Employee ID and it should return the salary and grade of that employee id. Need reply soon .
thank you in advance
Last edited on Jan 29, 2014 at 8:55am
Jan 29, 2014 at 10:05am
You wouldn't normally search a CSV file (or JSON or XML ...), they represent serialised data/objects that should be deserialised before processing.

So, read the CSV file into something and search that.
Jan 29, 2014 at 9:20pm
However, the serialization exists only on a per-record basis.

It would be sufficient to simply read the file on a line-by-line basis, and s.find( employee_id ) to determine whether or not you should bother deserializing the record into fields.
Topic archived. No new replies allowed.