Building list of lists from CSV file

前端 未结 3 876
不思量自难忘°
不思量自难忘° 2021-01-11 13:42

I have an Excel file(that I am exporting as a csv) that I want to parse, but I am having trouble with finding the best way to do it. The csv is a list of computers in my net

3条回答
  •  盖世英雄少女心
    2021-01-11 14:34

    It can be done using the pandas library.

    import pandas as pd
    
    df = pd.read_csv(filename)
    
    list_of_lists = df.values.tolist()
    

    This approach applies to other kinds of data like .tsv, etc.

提交回复
热议问题