Skip to content

Instantly share code, notes, and snippets.

@packmad
Created December 20, 2016 13:23
Show Gist options
  • Save packmad/8cdc924b191d6ccc6befafccb025505a to your computer and use it in GitHub Desktop.
Save packmad/8cdc924b191d6ccc6befafccb025505a to your computer and use it in GitHub Desktop.
Read a file and filter its content into another file
with open("/tmp/output.txt", "w") as output_file:
with open("/tmp/input.txt", "r") as input_file:
for line in input_file:
# process line
print(line, file=output_file, end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment