[docs] Documentation bug in glob examples

Georg Brandl georg at python.org
Wed Oct 5 17:57:49 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/05/11 17:04, Ewan Higgs wrote:
> Sir/Madame, I believe there is a bug in the documentation for the glob
> module accessed through the following url on 2011/10/05: 
> http://docs.python.org/library/glob.html
> 
> 
> Currently the example demonstrates the output of a series of globbing
> patterns in a directory with files 1.gif, 2.gif, and card.gif. The results
> returned are incorrect. They read:
> 
> 
>>>> import glob glob.glob('./[0-9].*')
> ['./1.gif', './2.txt']
>>>> glob.glob('*.gif')
> ['1.gif', 'card.gif']
>>>> glob.glob('?.gif')
> ['1.gif']
> 
> 
> However, the results should be as follows:
> 
> $python Python 2.6.5 (r265:79063, Apr 26 2010, 12:52:32) [GCC 4.4.3] on
> linux2 Type "help", "copyright", "credits" or "license" for more
> information.
>>>> import glob glob.glob('./[0-9].gif')
> ['./1.gif', './2.gif']
>>>> glob.glob('*.gif')
> ['1.gif', 'card.gif', '2.gif']
>>>> glob.glob('?.gif')
> ['1.gif', '2.gif']
>>>> 

Hi Ewan,

it seems to me that the example is correct: note that the second file is
called "2.txt", not "2.gif".

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iEYEARECAAYFAk6Mfn0ACgkQN9GcIYhpnLCyCACfc3BcT6AoXqv5EcbgOIedalQX
0rAAn2zYsYpSSf3mCEbM7bBUARL8DL8D
=eN8J
-----END PGP SIGNATURE-----


More information about the docs mailing list