将csv转换为字典
csv2dictionar的Python项目详细描述
时光康姆
用Malphrus-Tech实现csv文件到字典的转换
使用
导入
fromcsv2dictionary.csvproimportCsvBrain
使用
数据
^{pr2}$标题
case1=CsvBrain('test.csv')case1.header_labels#returns a list of Header labels
搜索
case1=CsvBrain('test.csv')case1.search('dog')#returns a list of dict's that contain "dog" as a value under any key
卡斯汀
case1=CsvBrain('test.csv')case1.castInt('age')#loops thru the list of dictionaries and changes cast all values under an 'age' key to integers
卡斯汀
case1=CsvBrain('test.csv')case1.castFloat('age')#loops thru the list of dictionaries and changes cast all values under an 'age' key to Floats
标签:
- 项目
case1=CsvBrain('test.csv')case1.castFloat('age')#loops thru the list of dictionaries and changes cast all values under an 'age' key to Floats
- 项目
标签: