Jul-06-2018, 02:03 AM
(Jun-25-2018, 07:59 AM)buran Wrote:from string import punctuation def find_words(phrase, control): phrase = phrase.lower().split() words = [word.rstrip(punctuation) for word in phrase if word[0] < control] return words my_phrase = "My pet is a Tiger; wild, white and with big eyes. Don't touch him." print(find_words(phrase=my_phrase, control='n'))['my', 'is', 'a', 'and', 'big', 'eyes', "don't", 'him']
Sorry for my late reply.
Thank you very much buran.
I understand from your quote that we can import the a punctuation package.
I am not familiar yet with 'rstrip' (just 'strip') so I will check it out.
Thank you again.
Shiro