Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84915
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Subject | Re: how to parse sys.argv as dynamic parameters to another function? |
| Date | 2015-01-30 14:05 -0500 |
| References | <baa4011f-0745-4f8b-a6f5-fc242a886d78@googlegroups.com> <CALwzid=2xNRdfCkJY9terZoZ1Ep385Y7-ESmoBLBKPQw0ZEgYA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18318.1422644725.18130.python-list@python.org> (permalink) |
On 1/30/15 11:28 AM, Ian Kelly wrote: > On Fri, Jan 30, 2015 at 9:09 AM, Robert Chen <robertchen117@gmail.com> wrote: >> how to parse sys.argv as dynamic parameters to another function? >> >> >> fun(sys.argv) >> >> in perl, this is very easy. please help. > > Do you mean that you want each item of sys.argv to be passed as a > separate parameter to the function? If so, then: > > fun(*sys.argv) > Robert, this will work, but keep in mind that sys.argv is a list of strings, always. If your function is expecting integers, you will have to do an explicit conversion somewhere. -- Ned Batchelder, http://nedbatchelder.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
how to parse sys.argv as dynamic parameters to another function? Robert Chen <robertchen117@gmail.com> - 2015-01-30 08:09 -0800 Re: how to parse sys.argv as dynamic parameters to another function? Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-30 10:16 -0600 Re: how to parse sys.argv as dynamic parameters to another function? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-30 09:28 -0700 Re: how to parse sys.argv as dynamic parameters to another function? Ned Batchelder <ned@nedbatchelder.com> - 2015-01-30 14:05 -0500
csiph-web