Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91934
| Path | csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dpalao.python@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'paths': 0.05; 'item.': 0.07; 'performs': 0.07; 'predefined': 0.07; 'iterate': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'files.': 0.13; 'organise': 0.16; 'set,': 0.16; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'sets': 0.23; 'header:In-Reply-To:1': 0.24; 'written': 0.24; 'sort': 0.25; 'question': 0.26; 'message- id:@mail.gmail.com': 0.28; 'path,': 0.29; 'url:mailman': 0.31; 'certain': 0.31; 'skip:[ 10': 0.32; 'structure': 0.32; 'url:python': 0.33; 'subject:use': 0.33; 'utility': 0.33; 'subject:?': 0.34; 'file': 0.34; 'add': 0.34; 'received:google.com': 0.34; 'that,': 0.34; 'url:listinfo': 0.35; 'could': 0.35; 'path': 0.35; 'really': 0.35; 'list': 0.35; 'url:org': 0.36; 'list,': 0.36; 'there': 0.36; 'hi,': 0.37; 'subject:: ': 0.37; 'files': 0.38; 'data': 0.40; 'some': 0.40; 'more': 0.62; 'here': 0.66; 'outline': 0.66; 'skip:\xe2 10': 0.70; 'sets,': 0.84; '8bit%:33': 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:to :cc:content-type:content-transfer-encoding; bh=4pVzQamX1fS/g2hoMfSaL/rk2hXKmJGudR2k9pYy0G4=; b=UKzFk92r7bvzZDCewiHYo/+RCiKUqttnzB2hANQbAo7371EtC09293cwjW5cK3yvbb Guri1XH+nNHDeJPa4cHpMp4kxKZUrNzvYDEWpRoqwCwBCjTh18HPxTKBrCV+ojRQKcXW 7roarlri4ZvNosAEFk0ihRm+QnFiBwIK2UsTGpQ82untc0rwNtk9Rg60EM7DqZfT0T0H VetZi6EuzYcSyysN0Fcj3tYenKnA4D/RX9OS7LMfinBRy5Kmdy7DZMNS+KnNebBEwAYb HagxZyGDc+mp+1+UGmht3zXyFREHer7ZOGEvNrfccsRAnJnUiRCMqIM7phVcuposYUjS IE+Q== |
| MIME-Version | 1.0 |
| X-Received | by 10.194.177.230 with SMTP id ct6mr8391101wjc.31.1433323353471; Wed, 03 Jun 2015 02:22:33 -0700 (PDT) |
| In-Reply-To | <41302A7145AC054FA7A96CFD03835A0A0B97DECA@EX10MBX02.EU.NEC.COM> |
| References | <41302A7145AC054FA7A96CFD03835A0A0B97DECA@EX10MBX02.EU.NEC.COM> |
| Date | Wed, 3 Jun 2015 11:22:33 +0200 |
| Subject | Re: What sort of data structure to use? |
| From | David Palao <dpalao.python@gmail.com> |
| To | David Aldrich <David.Aldrich@emea.nec.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.94.1433323355.13271.python-list@python.org> (permalink) |
| Lines | 76 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1433323355 news.xs4all.nl 2845 [2001:888:2000:d::a6]:57151 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91934 |
Show key headers only | View raw
2015-06-03 10:19 GMT+02:00 David Aldrich <David.Aldrich@emea.nec.com>:
> Hi
>
>
>
> I have written a Python utility that performs a certain activity on some
> predefined sets of files. Here is the outline of what I have written:
>
>
>
> # File Set A
>
> pathA = ‘pathA’
>
> fileListA = [‘fileA1.txt’, ‘fileA2.txt’]
>
>
>
> # File Set B
>
> pathB = ‘pathB’
>
> fileListB = [‘fileB1.txt’, ‘fileB2.txt’, ‘fileB3.txt’]
>
>
>
> myFunc1(pathA, fileListA)
>
> myFunc2(pathA, fileListA)
>
>
>
> myFunc1(pathB, fileListB)
>
> myFunc2(pathB, fileListB)
>
>
>
> I want to add more file sets, so I really want to add the sets to a list and
> iterate over the list, calling myFunc1 & myFunc2 for each item.
>
>
>
> My question is: what sort of data structure could I use to organise this,
> given that I want to associate a set of files with each path and that, for
> each set, there is an arbitrary number of files?
>
>
>
> Best regards
>
>
>
> David
>
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Hi,
What about a for loop?
paths = [pathA, pathB, pathC]
functions = (myFunc1, myFunc2)
file_lists = [fileListA, fileListB,fileListC]
for path, file_list in zip(paths, file_lists):
for f in functions:
f(path, file_list)
Best
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: What sort of data structure to use? David Palao <dpalao.python@gmail.com> - 2015-06-03 11:22 +0200
csiph-web