Python - Find longest (most words) key in dictionary -
is there way query dictionary object in order find key (all keys of string type) words?
i.e., if item largest key had 5 words {'this largest key': 3}, how query dict , have int '5' returned?
best, georgina
max of - count of words per key:
max(len(k.split()) k in d.keys())
Comments
Post a Comment