Generation

generate functionSat, 12 Nov 2022

Get the first ten lines of a file

def first_lines(file, num_lines): lines = [] with open(file) as myfile: for i in range(num_lines): lines.append(myfile.readline()) return lines

Want to kickstart your project?Use the new AI Studio to create your code