Created
November 24, 2019 22:49
-
-
Save okumura/2fb5b4e14ee5293ea49f97484f5924b2 to your computer and use it in GitHub Desktop.
wc -l
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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