Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108100
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Peter Otten <__peter__@web.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: Trouble porting glob bash behavior with argparse to windows shell |
| Date | Tue, 03 May 2016 23:15:45 +0200 |
| Organization | None |
| Lines | 20 |
| Message-ID | <mailman.363.1462310161.32212.python-list@python.org> (permalink) |
| References | <80f6672a-2b69-4749-821d-a92be107862a@googlegroups.com> <664703cb-ac1f-411d-a0d7-0a50a683d2fb@googlegroups.com> <ngb4e2$dtt$1@ger.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Trace | news.uni-berlin.de l1jutF/VIGsfv0aKWCzyeAGsY3b8E+Em/ykgQ59Q+klw== |
| 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.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '"+"': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'argument': 0.15; '"*"': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:argparse': 0.16; 'subject:windows': 0.16; 'wrote:': 0.16; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:f 40': 0.27; 'turns': 0.27; 'implicitly': 0.29; 'str': 0.29; 'list': 0.34; 'path': 0.35; 'something': 0.35; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'doing': 0.38; 'skip:p 20': 0.38; 'files': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'received:de': 0.40; 'skip:n 10': 0.62; 'obvious': 0.76 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | p57bd9cae.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <ngb4e2$dtt$1@ger.gmane.org> |
| X-Mailman-Original-References | <80f6672a-2b69-4749-821d-a92be107862a@googlegroups.com> <664703cb-ac1f-411d-a0d7-0a50a683d2fb@googlegroups.com> |
| Xref | csiph.com comp.lang.python:108100 |
Show key headers only | View raw
Sayth Renshaw wrote:
> Is there something obvious to this I am doing wrong?
> parser.add_argument("path", nargs="+")
The "+" implicitly turns args.path into a list
> files |= set(glob.glob(args.path + '/*' + args.extension))
so the glob() argument is evaluated as
list + str + str
Try
name_pattern = "*" + args.extension
for path in args.path:
files.update(glob.glob(os.path.join(path, name_pattern)))
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trouble porting glob bash behavior with argparse to windows shell Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-03 04:34 -0700
Trouble porting glob bash behavior with argparse to windows shell Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-03 13:55 -0700
Re: Trouble porting glob bash behavior with argparse to windows shell Peter Otten <__peter__@web.de> - 2016-05-03 23:15 +0200
Re: Trouble porting glob bash behavior with argparse to windows shell Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-04 00:56 -0700
Re: Trouble porting glob bash behavior with argparse to windows shell Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-04 00:57 -0700
Re: Trouble porting glob bash behavior with argparse to windows shell Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-15 20:21 -0700
Re: Trouble porting glob bash behavior with argparse to windows shell Peter Otten <__peter__@web.de> - 2016-05-16 08:58 +0200
Re: Trouble porting glob bash behavior with argparse to windows shell Terry Reedy <tjreedy@udel.edu> - 2016-05-03 18:00 -0400
csiph-web