Having lots of fun passing parameters ... help!

DAC derekacolley at googlemail.com
Mon Jun 18 16:24:09 CEST 2007


On 18 Jun, 14:57, "Diez B. Roggisch" <d... at nospam.web.de> wrote:
> DAC wrote:
> > I've defined a single method in Python using:
>
> > def funcAdjacents(inputWord, outputFile):
> >    ...
> >    lots of boring stuff
> >    ...
>
> > and then called it using:
>
> > funcAdjacents("SampleWord","outputFile.file")
>
> > Which works OK in Python - I get the results I want.  But what I'm
> > trying to do is get inputWord and outputFile to be parameters are
> > passed on the command line, e.g.
>
> > C:\Python\>  myScript.py "SampleWord" "outputFile.file"
>
> > And just to add to the fun, once I've reached this stage I would like
> > to either a) be able to execute this .py file from a HTML environment
> > or b) execute this file as a .exe and embed into HTML (which I can
> > do).
>
> You get the parameters to a script executed at the shell using
>
> import sys
> print sys.argv
>
> or in your case
>
> funcAdjacents(*sys.argv[1:])
>
> Executing this from HTML requires the usage of CGI. But without further
> details what you really are after here and what your webenvironment is, we
> won't be able to help you.
>
> Diez- Hide quoted text -
>
> - Show quoted text -

Thanks Diez, I understand what you mean.  I'm fine with the CGI aspect
of things, it was just getting those parameters across which was
difficult.

DAC.





More information about the Python-list mailing list