Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2009 09:24
Show Gist options
  • Save anonymous/256800 to your computer and use it in GitHub Desktop.
Save anonymous/256800 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: euc-jp -*-
import sys
import psyco
psyco.full()
wc=0
byte=0
newline=0
try:
fp=open(sys.argv[1], "r")
string=fp.read()
except:
exit()
for s in string:
byte+=1
if(s=="\n"):
wc+=1
newline+=1
elif(s==" "):
wc+=1
print newline, " ", wc, " ", byte, " ", sys.argv[1]
fp.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment