Last active
December 19, 2017 00:34
-
-
Save BlogBlocks/308f5b650cea1ae51b8566ea36d6d749 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/local/bin/python | |
| #Author: JackNorthrup | |
| #Usage : python viewNlines.py data/co2.csv 5 | |
| import sys | |
| PATH= sys.argv[1] | |
| try: | |
| N = int(sys.argv[2]) | |
| except ValueError: | |
| print "path is to be followed by number of lines to read" | |
| sys.exit(1) | |
| def Nlines(PATH,N): | |
| f=open(PATH) | |
| for i in range(N): | |
| line=f.next().strip() | |
| print line | |
| f.close() | |
| if __name__ == "__main__": | |
| Nlines(PATH,N) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
made public