Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84897 > unrolled thread
| Started by | Robert Chen <robertchen117@gmail.com> |
|---|---|
| First post | 2015-01-30 08:09 -0800 |
| Last post | 2015-01-30 14:05 -0500 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
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
| From | Robert Chen <robertchen117@gmail.com> |
|---|---|
| Date | 2015-01-30 08:09 -0800 |
| Subject | how to parse sys.argv as dynamic parameters to another function? |
| Message-ID | <baa4011f-0745-4f8b-a6f5-fc242a886d78@googlegroups.com> |
how to parse sys.argv as dynamic parameters to another function? fun(sys.argv) in perl, this is very easy. please help.
[toc] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2015-01-30 10:16 -0600 |
| Message-ID | <mailman.18310.1422634586.18130.python-list@python.org> |
| In reply to | #84897 |
On Fri, Jan 30, 2015 at 10:09 AM, Robert Chen <robertchen117@gmail.com> wrote: > > how to parse sys.argv as dynamic parameters to another function? > > > fun(sys.argv) Not sure what you mean by "dynamic", but I think you already have it, assuming fun is a function which accepts a single list of strings as its argument. Skip
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-01-30 09:28 -0700 |
| Message-ID | <mailman.18311.1422635372.18130.python-list@python.org> |
| In reply to | #84897 |
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)
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2015-01-30 14:05 -0500 |
| Message-ID | <mailman.18318.1422644725.18130.python-list@python.org> |
| In reply to | #84897 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web