Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to read first lines of a file

with open("datafile") as myfile:
    head = [next(myfile) for x in range(N)]
print(head)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #read #lines #file
ADD COMMENT
Topic
Name
8+1 =