def get_lines ( handle , line ) : for i , l in enumerate ( handle ) : if i == line : return l
give index of specific line in python
Get zero - indexed line from an open file - like .
def get_lines(handle, line):
    """
    Get zero-indexed line from an open file-like.
    """
    for i, l in enumerate(handle):
        if i == line:
            return l