Le mercredi 8 janvier 2014 20:00:02 UTC+1, Bischoop a écrit : > Walter Hurry wrote: > > > > > On Mon, 30 Dec 2013 18:38:20 +0000, Bischoop wrote: > > > > > >> I have a txt file with some words, and need simply program that will > > >> print me words containing provided letters. > > >> > > >> For example: > > >> Type the letters: > > >> (I type: g,m,o) > > >> open the dictionary.txt > > >> check words containing:g,m,o in dictionary.txt > > >> if there are words containing: ["g", "m", "o" ] > > >> print words with g,m,o > > > > > > Well, what have you tried so far, and what result did you get? > > > > > > The incredibly helpful people here will provide advice, guidance and > > > pointers, but it won't help you at all if they just do your homework for > > > you. > > > > > > Honestly Im newbie in Python, years ago (10 already) I wrote simply program > > something like a TEST: Capitals of Countries. You could learn the capitals > > of some countries, and then you could try to solve a test. I know it's seems > > so simply for you guys but I was quite pride of myself :-) > > > > Now because of free time I took my book which I used years ago about python > > and try to learn it again, and as motivation I try to write the program I > > described above just to give me a kick :-), however got no idea how to start > > it, I meand there is so many moduls (import this, import that), I know how > > to open, read file etc. Just stuck with that, got no clue what and how use > > this that what I need to seek the words from the files if I need a words > > with letters I want.
>>> # a starting point >>> lettres = set('üœŸ') >>> Wörter = ['abcüœŸb', 'aüꜟ', 'üœŸzzz', 'üœzz', 'Strauẞ', '', 'nul'] >>> for word in Wörter: ... tmp = set(word) ... print('{:10} : {}'.format(word, lettres.issubset(tmp))) ... abcüœŸb : True aüꜟ : True üœŸzzz : True üœzz : False Strauẞ : False : False nul : False >>> -- https://mail.python.org/mailman/listinfo/python-list