Switched from try except to isdigit in python

This provided a significant speedup