from random import choice from nltk.tokenize import sent_tokenize, word_tokenize with open("dixit.txt") as article: quotes = sent_tokenize(article.read()) text_out = "À ce propos, Einstein a dit un jour : \"%s\"." % quote print(text_out);