This question is similar to Python - Find longest (most words) key in dictionary - but I need the pure number of characters.
Example input:
d = {\'gr
>>> d = {'group 1': 1, 'group 1000': 0} >>> len(max(d, key=len)) 10
This solution is the fastest but I prefer the solutions by @eumiro and @ms4py since they do not repeat the len function twice and are more pythonic imo.
len