manuel trujillo

Generation

generate functionWed, 03 May 2023

Ecrire une fonction importer_mots qui prend en argument un nom de fichier nom_fichier et qui renvoie la liste des mots contenus dans ce fichier

def importer_mots(nom_fichier): with open(nom_fichier) as f: liste_mots = [mot.strip() for mot in f.readlines()] return liste_mots importer_mots("test.txt")

Questions about programming?Chat with your personal AI assistant