Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
check if letters in a words
#1
I have a file containing words, a word in a line.
I try to print a words containing specific letters ( if all letters given in input are in a word: print word) , I tried different ways but ending up with different errors or no error but no print out anything.
x = input('letters: ')
y= open('noweslowa').read().splitlines()

for word in y:
    if all in x in word:
        print(word)

~          
Reply


Messages In This Thread
check if letters in a words - by Vimart - Aug-10-2020, 08:00 PM
RE: check if letters in a words - by Gribouillis - Aug-10-2020, 08:09 PM
RE: check if letters in a words - by Vimart - Aug-10-2020, 08:25 PM
RE: check if letters in a words - by bowlofred - Aug-10-2020, 09:21 PM
RE: check if letters in a words - by deanhystad - Aug-10-2020, 09:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,917 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Replacing a words' letters in a string cananb 2 3,551 Dec-01-2020, 06:33 PM
Last Post: perfringo
  Check text contains words similar to themes/topics (thesaurus) Bec 1 38,407 Jul-28-2020, 04:17 PM
Last Post: Larz60+
  how to check if string contains ALL words from the list? zarize 6 7,480 Jul-22-2020, 07:04 PM
Last Post: zarize
  item from a line to list however when i print the line instead of words i get letters Sutsro 5 3,084 Apr-22-2020, 02:39 PM
Last Post: deanhystad
  How to Continuously Remove Letters from Words ZQ12 1 2,622 Nov-23-2019, 05:31 PM
Last Post: perfringo
  Compare all words in input() to all words in file Trianne 1 2,824 Oct-05-2018, 06:27 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020