From 4f552e370e656cc1882a7dae231475a016f8aa14 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 18 Oct 2019 13:26:24 -0700 Subject: [PATCH] acknowledgment --- jc/parsers/ps.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jc/parsers/ps.py b/jc/parsers/ps.py index c3c27bfa..f494d452 100644 --- a/jc/parsers/ps.py +++ b/jc/parsers/ps.py @@ -14,8 +14,10 @@ Examples: def parse(data): - cleandata = data.splitlines() + # code adapted from Conor Heine at: + # https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501 + cleandata = data.splitlines() headers = [h for h in ' '.join(cleandata[0].strip().split()).split() if h] raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), cleandata[1:]) return [dict(zip(headers, r)) for r in raw_data]