在python中,我有一个csv文件,其中包含很多参数,例如:
Name, Surname, Address1, Address2, email, etc
Adam1,Smith1,12 Connaugh Rd.,,adamsmith@gmail.com, etc...
Adam2,Smith2,12 Connaugh Rd.,,adamsmith@gmail.com, etc...
Adam3,Smith3,12 Connaugh Rd.,,adamsmith@gmail.com, etc...
我如何阅读它,所以第一行名称,姓氏,地址1,地址2,电子邮件等成为字典中参数的名称?这样我就可以
Dict{Name:Adam1,Adam2, Adam3
Surname: Smith1,Smith2,Smith3
Address1: 12 Connaugh Rd.,12 Connaugh Rd.,12 Connaugh Rd.
etc.}
由于我将来会使用它,是使用csv的最佳方法还是有更好的方法?
Update1:ripr(row)给出:
{None: ['\tSales Record Number', 'User Id', 'Buyer Full name', 'Buyer Phone Number', 'Buyer Email', 'Buyer Address 1', 'Buyer Address 2', 'Buyer Town/City', 'Buyer County', 'Buyer Postcode'