B
    5Q'                 @   sR   d d Z edZedZedZe eee eedddZee  ed d	S )
c       
      C   s   yt | ddd}W n   td| d Y nX d}| }xV|dkr|dt|d	  }| }x$|D ]}| | krd|d	7 }qdW | }q:W |  t |d
dd}d| ||}	||	 |  dS )u   
    compteur(str source, str destination, str motCherche) --> None.
    Compte le nombre d'occurrences de <motCherche> dans le fichier
    <source> (encodé en Utf-8) et écrit le résultat dans le
    fichier <destination> (encodé en Latin-1).
    rzutf-8)encodingz
Le fichierzn'existe pas.     N   wzLatin-1z3Le fichier "{}" contient {} occurrences du mot "{}")	openprintreadlinelensplituppercloseformatwrite)
sourceZdestinationZ
motChercheZInputcounterZligneZ	listeMotsmotZOutputresult r   o/Users/jerome/SynologyDrive/College/Informatique/OCI/1_Site/1_Programmation/6_Fichiers/Exercices/Ex6_7/ex6_7.pycompteur   s$    


r   z$Entrez l'adresse du fichier source: z)Entrez l'adresse du fichier destination: u   Entrez le mot à chercher: r   zLatin-1)r   z/Appuyez sur une touche pour fermer la fenetre !N)	r   inputZentreeZsortier   r   Zreponser   readr   r   r   r   <module>   s   "