On Mon, Dec 29, 2014 at 9:35 AM, JC <chalao.a...@gmail.com> wrote: > How could I get the all the records?
This should work: with open('x.csv','rb') as f: rdr = csv.DictReader(f,delimiter=',') rows = list(rdr) You will be left with a list of dictionaries, one dict per row, keyed by the values in the first row: >>> import csv >>> with open('x.csv','rb') as f: ... rdr = csv.DictReader(f,delimiter=',') ... rows = list(rdr) ... >>> import pprint >>> pprint.pprint(rows) [{'id': '1', 'name': 'ABC', 'password': '1234', 'userid': 'def@ghi'}, {'id': '2', 'name': 'DEF', 'password': 'asdf', 'userid': 'ghi@jkl'}, {'id': '3', 'name': 'GHI', 'password': 'zxcv', 'userid': 'jkl@mno'}] Skip -- https://mail.python.org/mailman/listinfo/python-list