netbox-agent/netbox_agent/drivers/datacenter_file.py

10 lines
191 B
Python
Raw Normal View History

import re
def get(value, regex):
for line in open(value, 'r'):
r = re.search(regex, line)
2019-08-04 19:51:36 +02:00
if r and len(r.groups()) > 0:
return r.groups()[0]
return None