google / textfsm

Python module for parsing semi-structured text into python tables.
Apache License 2.0
1.09k stars 168 forks source link

Support returning list of dicts #30

Closed ytti closed 5 years ago

ytti commented 6 years ago

Many uses cases end up doing something like this

for row in rows:
  column1, column2, column3, columnN = row
  submit(
    column1: column1,
    column2: Metric(column2),
    column3: column3,
    columnN: columnM,

Sometimes it leads to unnecessary wet (is that opposite of dry) code, as you may not actually CARE about most of the column name. In my use case, I only care if column name is metric or label, so I'd rather do something like this.

for row in rows:
  row["column2"] = Metric(row["column2"])
  submit(row)

The rest I can rely on be labels, and thus don't need to do anything to them.