Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. line_ap = lines[find_substr_in_lines(lines, "AP (")]
  2. parse_ap(line_ap, row)
  3.  
  4. #parse number of ap courses
  5. def parse_ap(line, row):
  6. regex = re.compile(r'\((\d+)\)')
  7.  
  8. regMatch = regex.findall(line)
  9. commas = line.count(",")
  10.  
  11. if len(regMatch) > 0 and len(regMatch) > commas:
  12. row.append(str(len(regMatch)))
  13. elif line.find(","):
  14. line = line.split(";")
  15. result = 0
  16. for section in line:
  17. section = section.split(",")
  18. result += len(section)
  19. row.append(str(result))
  20. else:
  21. row.append("none")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement