Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63546
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'pat': 0.05; 'class,': 0.07; 'trailing': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'class).': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ought': 0.16; 'supplied': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'character': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'pipe': 0.31; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'representing': 0.36; 'skip:[ 10': 0.38; 'anything': 0.39; 'sure': 0.39; 'expression': 0.60; 'letters': 0.60; 'skip:o 30': 0.61; 'simply': 0.61; 'significance': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=rirNA3o4/EhO/yPb9Oj9jdENoo5vwOnV1YwkkucUmyI=; b=zDqcPQdUi4b22LSd/VN8gMLThLqPOKdysUoegLn/Peuo+/7RjwXJbD+zgkVPgdpdq+ LXvQzo0vke7MyY3qWxMyoASpgWUxxu63kL1uRkuLVw1OMG9Fl6+lr3mXQ5wHq91a10A3 OvN/HOHeaQ7pCoCwPQY6pgBSrzNJ5N1wiubeskb7DeTy2KKT6vT+YthZt1FWCO7O2ry1 vLeAEK7W3H7MFb83Tx3OTRO4GDOL83MpWjysFOKxtvL0HTgL+SDFSEkiLLyM7oEF/HJg SQvqdLTxtXeOm2ctxPN3/s3yZRQSFBMcrGvWrjGSUM6V6JjoK5mqICfb2TGAPF6K7Khw T8kw== |
| MIME-Version | 1.0 |
| X-Received | by 10.66.118.71 with SMTP id kk7mr183167pab.14.1389226903508; Wed, 08 Jan 2014 16:21:43 -0800 (PST) |
| In-Reply-To | <vcprc9l33287s827e421tbib9tvlkb0pb1@4ax.com> |
| References | <x4jwu.3413$Bs5.1921@fx09.am4> <mailman.4725.1388433616.18130.python-list@python.org> <P6hzu.2028$Wn7.1602@fx20.am4> <vcprc9l33287s827e421tbib9tvlkb0pb1@4ax.com> |
| Date | Thu, 9 Jan 2014 11:21:43 +1100 |
| Subject | Re: Dictionary |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5217.1389226906.18130.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1389226906 news.xs4all.nl 2886 [2001:888:2000:d::a6]:46477 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63546 |
Show key headers only | View raw
On Thu, Jan 9, 2014 at 11:13 AM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> #generate search re expression representing
> # .* any character/multiple -- leading
> # [l|e|t|t|e|r] match any of the letters supplied
> # .* any character/multiple -- trailing
> needle = ".*[" + "|".join(list(letters.lower())) + "].*"
I don't think this will do what you think it will. It'll match
anything that has any one of the supplied letters (or a pipe; it's a
character class, so the pipe has no significance and is simply part of
the class). I'm not sure a regex is the best thing here; but what you
could do is sort the letters and sort the letters in the words:
pat = ".*".join(sorted(letters.lower()))
for word in open("/usr/share/dict/words"): # Ought to use with
if re.search(pat, ''.join(sorted(word))): print(word)
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Dictionary Bischoop <martin@jakis.adres.em> - 2013-12-30 18:38 +0000
Re: Dictionary Walter Hurry <walterhurry@gmail.com> - 2013-12-30 18:56 +0000
Re: Dictionary Bischoop <martin@jakis.adres.em> - 2014-01-08 19:00 +0000
Re: Dictionary wxjmfauth@gmail.com - 2014-01-09 00:31 -0800
Re: Dictionary Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-12-30 15:00 -0500
Re: Dictionary Bischoop <martin@jakis.adres.em> - 2014-01-08 18:51 +0000
Re: Dictionary Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-08 19:13 -0500
Re: Dictionary Chris Angelico <rosuav@gmail.com> - 2014-01-09 11:21 +1100
csiph-web