I'm getting a valueError on the below code.
ValueError('too many values to unpack',)
with open('38374657484839373636.csv') as f:
for line in f.read().split('\n'):
if line:
repo, file, pkey = line.split(",")
keys.add(pkey)
The easiest way to read CSV-files (and Excel-files too with pd.read_excel()
) is to use Pandas
import pandas as pd
df = pd.read_csv('38374657484839373636.csv')
df.head()
Sometimes it is necessary to set the delimiter explicitly, depending on what's in our input file. E.g, if the delimiter in your file is /
import pandas as pd
df = pd.read_csv('38374657484839373636.csv', delimiter='/')
df.head()
Watch also wether your csv-file has a header or not. E.g.:
import pandas as pd
df = pd.read_csv('38374657484839373636.csv', delimiter='/',header=None)
df.head()