Sorry for submitting a question this small but it's driving me nuts. I have this single line which is permanently giving me syntax error:
print(BDF) if header is 1
I've also tried this:
print(BDF) if (header == 1)
Here's the full function:
def CSVtoDict(BDF, prune, header):
# Comes with the option to prune [] and to use headers
with open('%s%s.csv' % (dataDir,BDF), mode='r') as infile:
reader = csv.reader(infile)
saved = {}
for row in reader:
key = row[0]
saved[key] = [r for r in row[1:] if not (r is '' and prune is 1)]
print(BDF) if header is 1
return saved
What could possibly be causing this? I'm calling the function with:
adsMut = CSVtoDict(BaseDataFiles[0],1,1)
Everything seems to be in order, it just gives me syntax error every time.
Aucun commentaire:
Enregistrer un commentaire