> from itertools import groupby
> def get_lines_from_file(file_name):
> with open(file_name) as reader:
> for line in reader.readlines():
> counter = 0
> def key_func(x):
> if x.startswith("Starting a new group"):
> global counter
> counter += 1
> return counter
> for key, group in groupby(get_lines_from_file("my_data"), key_func):
Thank you for the responses! Not sure yet which one I will pick.
|All times are GMT. The time now is 04:25 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.