date: datetime
How can I remove from a list[Stuff] all objects that have timedelta between them less than, say, 10 minutes?
I don’t need the exact code, just the algorithm in plain English would suffice. Thanks!
hint: >>>a = [1,2,3,4] >>>list(zip(a, a[1:])) [(1, 2), (2, 3), (3, 4)]
Nope, still can’t figure it out( I’m trying things like for x, y in c: if abs(x.date - y.date) > timedelta(minutes=5): lst.append(x) lst.append(y)
what is c here?
zip on ?
Maybe itertools.pairwise might help
Обсуждают сегодня