I'm trying to find a record in a csv file in a nested stucture:
for elem in lstLine[1:]:
for item in open(fname):
lstData = item.rstrip('\n').split(';')
andexfield = lstData[0]
if andexfield == elem:
do bladibla
Now I want ot add error handling:
if no record in fname is found where andexfield == elem
print "Error, no andexfield in fname"
Can I do this with "try" ?
Any help is much appreciated.