U
    /`Žc  ã                   @   s.   d Z G dd„ dƒZedkr*ee dd¡ƒ dS )zjUtility class for Seven Little Words.

Author CS149 Profesors, James Madison University
Version Fall 2018
c                   @   s   e Zd Zdd„ ZdS )ÚFileUtilitiesc                 C   s\   zFt | dƒ}| ¡ }t|ƒdkr&d}ndd„ |D ƒd|… }| ¡  W n   d}Y nX |S )a5  Read and return the given number of lines from the given file.
     
         Args:
            filename(str): The name of the file to read from
            number_of_lines(int): The number of lines to read
    
        Returns:
            (list): The array of lines (or null if there was a problem)
        Úré    Nc                 S   s   g | ]}|  ¡ ‘qS © )Ústrip)Ú.0Úliner   r   úfile_utilities.pyÚ
<listcomp>   s     z6FileUtilities.read_lines_from_file.<locals>.<listcomp>)ÚopenÚ	readlinesÚlenÚclose)ÚfilenameZnumber_of_linesÚfÚlinesÚresultr   r   r   Úread_lines_from_file	   s    

z"FileUtilities.read_lines_from_fileN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   r   Ú__main__zjmu.txté   N)Ú__doc__r   r   Úprintr   r   r   r   r   Ú<module>   s   