Skip to content

Instantly share code, notes, and snippets.

@okumura
Created November 24, 2019 22:49
Show Gist options
  • Save okumura/2fb5b4e14ee5293ea49f97484f5924b2 to your computer and use it in GitHub Desktop.
Save okumura/2fb5b4e14ee5293ea49f97484f5924b2 to your computer and use it in GitHub Desktop.
wc -l
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def wc_naive(name):
with open(name, 'r') as f:
return sum(1 for line in f)
print(wc_naive(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment