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


Groups > comp.lang.python > #104256

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

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: fnmatch() vs. glob.glob()
Date 2016-03-08 08:37 +1100
Message-ID <mailman.50.1457386649.10335.python-list@python.org> (permalink)
References <d8ec5d47-3393-41c3-a06c-0ec058763570@googlegroups.com>

Show all headers | 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