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


Groups > comp.lang.python > #25645

Re: shutil ignore fails on passing a tuple?

Date 2012-07-19 15:20 -0400
From Dave Angel <d@davea.name>
Subject Re: shutil ignore fails on passing a tuple?
References <50083935$0$6851$e4fe514c@news2.news.xs4all.nl>
Newsgroups comp.lang.python
Message-ID <mailman.2314.1342725661.4697.python-list@python.org> (permalink)

Show all headers | View raw


On 07/19/2012 12:43 PM, Alex van der Spek wrote:
> This beats me:
> ++++++++++++++++++++
>>>> ipatterns
> ('*.txt', '*.hdf', '*.pdf', '*.png')
>>>> igf = shutil.ignore_patterns(ipatterns)
>>>> ignorethis = igf(ddftopdir,os.listdir(ddftopdir))
>
> <SNIP>
> Why does it fail on passing in a tuple of ignore strings? I thought
> the , (comma) is pretty much the tuple constructor (if that is the
> right word).
>

ignore_patterns() is not looking for a tuple, it's looking for one or
more strings, as separate arguments.  If you already have the tuple, you
can expand it by using the asterisk, as Prasad ha pointed out.

igf = shutil.ignore_patterns(*ipatterns)

-- 

DaveA

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


Thread

shutil ignore fails on passing a tuple? "Alex van der Spek" <zdoor@xs4all.nl> - 2012-07-19 18:43 +0200
  RE: shutil ignore fails on passing a tuple? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-19 16:52 +0000
  Re: shutil ignore fails on passing a tuple? Joel Goldstick <joel.goldstick@gmail.com> - 2012-07-19 12:55 -0400
  Re: shutil ignore fails on passing a tuple? Dave Angel <d@davea.name> - 2012-07-19 15:20 -0400

csiph-web