Skip to content

Instantly share code, notes, and snippets.

@DonBattery
Created December 4, 2018 08:16
Show Gist options
  • Save DonBattery/559503c8b0f98f04bc628cfcda60daed to your computer and use it in GitHub Desktop.
Save DonBattery/559503c8b0f98f04bc628cfcda60daed to your computer and use it in GitHub Desktop.
read lines from stdin (or pipe) and process them
#!/usr/bin/env python3
import fileinput
def process(line):
print(line)
for line in fileinput.input():
process(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment