next closest time

🏠

Credit: stefan pochman

1 def nextClosestTime(self, time):
2     return min((t <= time, t)
3                for i in range(24 * 60)
4                for t in ['%02d:%02d' % divmod(i, 60)]
5                if set(t) <= set(time))[1]