4 ms·
Handy tip if you’re parsing the output of a command in your programming language of choice: output = run( “list-cats”, “—format”, “%(name)s\x1f%(
by gorgoiler 3y ago
Handy tip if you’re parsing the output of a command in your programming language of choice:
output = run(
“list-cats”,
“—format”,
“%(name)s\x1f%(age)s\x1e”,
)
records = output.split(“\x1e”)
cats = dict(
r.split(“\x1f”)
for r in records
)
In reality it’s a bit fastidious to use RS and US. I tend to just use “\1” and “\2”.