mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-11 01:10:37 +02:00
doc fix
This commit is contained in:
@ -7,10 +7,7 @@ jc - JSON CLI output utility universal Parsers
|
|||||||
simple_table_parse(data)
|
simple_table_parse(data)
|
||||||
```
|
```
|
||||||
|
|
||||||
Parse simple tables. The last column may contain data with spaces
|
Parse simple tables. The last column may contain data with spaces.
|
||||||
|
|
||||||
code adapted from Conor Heine at:
|
|
||||||
https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501
|
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
||||||
|
@ -6,10 +6,7 @@ import string
|
|||||||
|
|
||||||
def simple_table_parse(data):
|
def simple_table_parse(data):
|
||||||
"""
|
"""
|
||||||
Parse simple tables. The last column may contain data with spaces
|
Parse simple tables. The last column may contain data with spaces.
|
||||||
|
|
||||||
code adapted from Conor Heine at:
|
|
||||||
https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501
|
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
||||||
@ -26,6 +23,8 @@ def simple_table_parse(data):
|
|||||||
|
|
||||||
List of Dictionaries
|
List of Dictionaries
|
||||||
"""
|
"""
|
||||||
|
# code adapted from Conor Heine at:
|
||||||
|
# https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501
|
||||||
headers = [h for h in ' '.join(data[0].strip().split()).split() if h]
|
headers = [h for h in ' '.join(data[0].strip().split()).split() if h]
|
||||||
raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), data[1:])
|
raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), data[1:])
|
||||||
raw_output = [dict(zip(headers, r)) for r in raw_data]
|
raw_output = [dict(zip(headers, r)) for r in raw_data]
|
||||||
|
Reference in New Issue
Block a user