Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104256

Re: fnmatch() vs. glob.glob()

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: fnmatch() vs. glob.glob()
Date Tue, 08 Mar 2016 08:37:17 +1100
Lines 23
Message-ID <mailman.50.1457386649.10335.python-list@python.org> (permalink)
References <d8ec5d47-3393-41c3-a06c-0ec058763570@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de Qvzvv2tJrVM4CNJ8LWJ8Xw3PNvS5xQN/4lyQFjpLceCg==
Cancel-Lock sha1:Pfd3XYeSXzsN/1VEunMzIyxpdfU=
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.028
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'filenames': 0.07; 'modules.': 0.09; 'patterns,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:()': 0.09; 'python': 0.10; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'bit': 0.23; 'matching': 0.23; 'unlike': 0.23; 'unix': 0.24; 'module': 0.25; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'adams': 0.29; 'cases.': 0.29; 'closer': 0.29; 'character': 0.29; "i'm": 0.30; 'possibly': 0.32; 'url:python': 0.33; 'url:org': 0.36; 'beginning': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'seem': 0.37; 'starting': 0.37; 'stuff': 0.38; 'hi,': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'goal': 0.64; 'between': 0.65; 'goals': 0.67; 'subject:. ': 0.67; 'skip:\xe2 10': 0.70; '8bit%:40': 0.72; 'special': 0.73; '_o__)': 0.84; 'received:125': 0.84; 'studying': 0.84; 'treats': 0.84; '\xe2\x80\x9cwe': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
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:104256

Show key headers only | View raw


Jinghui Niu <niujinghui@gmail.com> writes:

> Hi, I've been studying python 3 modules. I'm a bit confused about the
> possibly overlap between fnmatch() and glob(), they seem to achieve
> the same goals exactly. Why duplicate?

>From the module documentation:

    Note that unlike fnmatch.fnmatch(), glob treats filenames beginning
    with a dot (.) as special cases.

    <URL:https://docs.python.org/2/library/glob.html>

So the goals are different: ‘glob.glob’ has the goal of matching closer
to the Unix meaning of glob patterns, where filenames starting with a
“.” character are conventionally treated as “hidden by default”.

-- 
 \      “We are stuck with technology when what we really want is just |
  `\                                 stuff that works.” —Douglas Adams |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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