Last active
December 19, 2017 00:26
-
-
Save BlogBlocks/fceef9445be08ee1c2ee76a56451a140 to your computer and use it in GitHub Desktop.
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/local/bin/python | |
""" | |
View the head and as many lines as you wish | |
the last argv 9 will print the head and 7 lines | |
eight lines total | |
Usage: | |
python viewCSVlines.py co2.csv 8 | |
""" | |
import sys | |
filename = sys.argv[1] | |
num = sys.argv[2] | |
num = int(num) | |
with open(filename) as myfile: | |
head = [next(myfile) for x in xrange(num)] | |
mystring = ''.join(head) | |
print mystring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment