Answers for "how to read first lines of a file"

0

how to read first lines of a file

with open("datafile") as myfile:
    head = [next(myfile) for x in range(N)]
print(head)
Posted by: Guest on August-10-2021

Code answers related to "how to read first lines of a file"

Browse Popular Code Answers by Language