for line in actorFile: matches = regex.match(line) if(matches and len(matches.group(1)) != 0): actorName = matches.group(1) addedPerson = False if(matches and matches.group(2) and not matches.group(3) and not matches.group(4)): try: if(matches.group(2) in titles): if(not addedPerson): clean = cleanName(actorName) s.addPerson(clean) addedPerson = True s.addPerformance(clean, matches.group(2)) s.addCharacter(matches.group(2), clean, matches.group(5).replace("[","").replace("]","")) #print clean + " AS " + matches.group(5) nParticipations += 1 except: continue # print actorName + " ::: " + matches.group(2) + " ::: " + matches.group(5) print "FINISHED PARSING ACTORS : " + str(nParticipations) #-------------------------------------------------------------------------------------- #ACTRESSES actressFile = open( PATH + ACTRESS_FILE )