Rilcon42 Rilcon42 - 1 year ago 423
Python Question

Iterating over dictionary with wildcard key matching

I am trying to iterate over a dictionary in order to retrieve all values that match the pattern

for the key. Is this possible in Python?

for data in input_file:

Answer Source

You just iterate over your dictionary, and do a pattern match on the key.

for key in dict
    if re.match(r'npi[0-9]+', key):
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download