Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108100
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Trouble porting glob bash behavior with argparse to windows shell |
| Date | 2016-05-03 23:15 +0200 |
| Organization | None |
| 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> |
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