Skip to content

Instantly share code, notes, and snippets.

@devendranaga
Created July 3, 2015 15:38
Show Gist options
  • Save devendranaga/94364ee620be05042c7b to your computer and use it in GitHub Desktop.
Save devendranaga/94364ee620be05042c7b to your computer and use it in GitHub Desktop.
counts the number of sloc (Github)
#!/usr/bin/python
import sys
import os
if len(sys.argv) != 2:
print sys.argv[0] + " " + "filename"
exit(0)
fd = open(sys.argv[1], "r")
count = 0
for line in fd:
line = line.strip(' \n')
if len(line) > 0:
count = count + 1
fd.close()
print " no of slocs " + str(count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment