CLI Pipeline I/O
1. Question
Using CLI pipeline, “|”, pass the previous output to the next function/script as input
2. User Case
using the example.json
contents as the input for parse_data.py
cat example.json | python3 parse_data.py
3. Solutions
using the fileinput
module
#!/usr/bin/env python3
import fileinput
with fileinput.input() as f_input:
for line in f_input:
print(line, end='')