Looking at the rest of the template, don't you want to either limit the split to the first 3 commas (maxsplit=3) or (preferred by me) check that the len(components) == 4? And to be complete, you should check that int(components[2]) doesn't throw a ValueError exception.
|