📜  如何读取文件的第一行 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:48.284000             🧑  作者: Mango

代码示例1
with open("datafile") as myfile:
    head = [next(myfile) for x in range(N)]
print(head)