You can do pairwise iteration with itertools.izip_longest.