Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104308
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: fnmatch() vs. glob.glob() |
| Date | Tue, 8 Mar 2016 12:56:32 +1100 |
| Lines | 24 |
| Message-ID | <mailman.24.1457402196.15725.python-list@python.org> (permalink) |
| References | <d8ec5d47-3393-41c3-a06c-0ec058763570@googlegroups.com> <mailman.50.1457386649.10335.python-list@python.org> <14061576-1c44-49bb-a27b-279e43258f06@googlegroups.com> <mailman.15.1457398847.15725.python-list@python.org> <7475bb64-b2e7-45ff-a94e-dbc62f658fab@googlegroups.com> <mailman.17.1457399791.15725.python-list@python.org> <a0d8dba4-834b-4e28-95a6-43f8667fe2ce@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de XqWvM8cLfPD+tFqafT8DgAez1tIgQl6UOAru6NNf1Ucg== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'e.g.,': 0.07; 'verbatim': 0.07; 'cc:addr:python-list': 0.09; 'excluding': 0.09; 'second.': 0.09; 'subject:()': 0.09; 'type;': 0.09; 'whatever.': 0.09; 'files.': 0.13; 'appropriate': 0.14; 'things.': 0.15; '2016': 0.16; 'at.': 0.16; 'fnmatch': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'regex,': 0.16; 'smart,': 0.16; 'wrote:': 0.16; 'switched': 0.18; 'typing': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'do.': 0.22; 'trying': 0.22; 'fit': 0.23; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'updating': 0.27; 'wonder': 0.27; 'message- id:@mail.gmail.com': 0.27; 'module.': 0.27; 'specify': 0.27; 'regular': 0.29; 'mention': 0.30; 'certain': 0.31; 'real-time': 0.33; 'tue,': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'according': 0.36; 'but': 0.36; 'serve': 0.36; 'received:209.85': 0.36; 'depends': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'itself': 0.38; 'received:209': 0.38; 'files': 0.38; 'different': 0.63; 'here:': 0.63; 'within': 0.64; 'mar': 0.65; "they're": 0.66; 'subject:. ': 0.67; 'feeling': 0.72; 'search,': 0.72; 'sounds': 0.76; '12:37': 0.84; 'chrisa': 0.84; 'gut': 0.84; 'to:none': 0.91 |
| 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-transfer-encoding; bh=yGK/X24UQQZUus3Gb2h6zMhkvOm8mUHTTefevx4FoDw=; b=JpBh+wMJQvMhDROj1FimmPx04VNEFbBCaszLWQCOsf82Tf7QVGu9Xq3S8Y1X5Yrn4e h13dw/HsJJax4vs+NPk5WD/UtPiByIYFJ27ooA3VM+2dnjYBf5TRq0bmzRwFbImPXGAB mwJpi8wd6sr3m1gRfUAu4y8lYPdQ+qSni4nndDy2kKSAYq5XfvgNQdL3pAYPCGrFilpg +UXA98eWSQmWdD0F7vUm7rHFA5f0xPHcFNKtavvY9eKeOWLxtx0UhmnvLmdtzwOAQx6N 9Iuw49EbY1RVIoX5KwuwlNfshMhmyxV3X5fiDlLGO9hXAn8wuLXTcheoo/XbMUOk7AmR HfKA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-transfer-encoding; bh=yGK/X24UQQZUus3Gb2h6zMhkvOm8mUHTTefevx4FoDw=; b=mXIsn3kIkaX8gphaNh04isRZ8xFnrVACYZWY9CqA8Yh3Q2xBOkldJcOJz1EVikBQhe yAQkkFF8DBmXRWLVSHanKyBA/JKiq/NDdejgcm1kNnN+3qHFyY3KbGf2WlTsfi3CElKc LuOfg3yWq7SzgBQhjqXUc2dO34p0AnaX7SySz2n+zRDud62SSkEbcdfeSU+p/rAj48Gp hR6Sj3M0gbajr4nsQOkgtSRY8yt18PDbp/YGcRuGTLF+7qgnBcxUMRx+TuRwY3bxf/TF PIc5326YSRNnYl6O8/zhfD8rw4/4en/FWXSeMcj5af2Z3N+684ZvWwoGT98ESn87GgZT /0Jw== |
| X-Gm-Message-State | AD7BkJJk+x4rCKcs7gfPRxF0jbT746bFFF0YUpEcxEDdMikTteLaX8ZK2BmxAlpMX/7AgdhqLjnhNcE5CBQkbw== |
| X-Received | by 10.107.47.163 with SMTP id v35mr22299084iov.19.1457402192722; Mon, 07 Mar 2016 17:56:32 -0800 (PST) |
| In-Reply-To | <a0d8dba4-834b-4e28-95a6-43f8667fe2ce@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| 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> |
| Xref | csiph.com comp.lang.python:104308 |
Show key headers only | View raw
On Tue, Mar 8, 2016 at 12:37 PM, Jinghui Niu <niujinghui@gmail.com> wrote: > Let me try to describe the behaviours as much as I can here: It is a real-time search, updating the search result as you type; It is very smart, not limiting itself into the verbatim words, but extracting feature strings automatically, e.g., typing "fontz" will match not just "*fontz*", but also "font-size", "fontzipper", etc; It can be switched for certain type of files according specific rules, such as not including ".pyc" files. > > My gut feeling is that it is using Regex, but just wonder how I can fit Regex into either fnmatch() or glob() module. Sounds to me like you're looking at two different things. 1) File name matching, whether with fnmatch or glob, will tell you which files to look at. You mention excluding .pyc files; you could specify that only "*.py" be matched, or "*q*.py", or whatever. 2) Regular expression or other searching, within the files. Either fnmatch or glob will serve you well for the first; I don't think they're appropriate for the second. But it depends what you're trying to do. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 12:17 -0800
Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 08:37 +1100
Re: fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 16:53 -0800
Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 12:00 +1100
Re: fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 17:04 -0800
Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 12:16 +1100
Re: fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 17:37 -0800
Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 12:49 +1100
Re: fnmatch() vs. glob.glob() Chris Angelico <rosuav@gmail.com> - 2016-03-08 12:56 +1100
Re: fnmatch() vs. glob.glob() MRAB <python@mrabarnett.plus.com> - 2016-03-08 02:35 +0000
Re: fnmatch() vs. glob.glob() Steven D'Aprano <steve@pearwood.info> - 2016-03-08 13:19 +1100
csiph-web