[Tutor] Newbie (Argument; built-in modules)
runsun
runsun@bilbo.bio.purdue.edu
Mon, 24 Sep 2001 12:24:47 -0500
Hi All,
I am pretty new to python (only 2 days old). Can some one point some
directions for the following "puzzles" (to me they are :) ) :
1.
How can I pass arguments to a cgi from a browser url address box ?
For example, you type
[..path..]/mypy.cgi?firstname=runsun&lastname=pan
I've tried a bit and managed to made a cgi:
http://expert.cc.purdue.edu/~runsun/python/argtest/argtestpy.cgi?A+Name:pan+
"test
but it has many limitions. For example, putting an "=" in the argument
disable the argument passing completely; and, some characters are
preceeded automatically during the argument passing with a "\" (for
example, http://...../~runsun is passed as http://...../\~runsun. Please
visit the above link for details.
2.
Where can I find a reference for all the built-in modules ?
Sincerely,
pan
======================================
~~ Be like water, be shapeless ~~
Runsun Pan, PhD, Biological Sci. Purdue Univ
Email: runsun@bilbo.bio.purdue.edu
Url : http://bilbo.bio.purdue.edu/~runsun
Tel : 765-496-4186(H), 765-494-4947 (O)
Fax : 775-665-1494 (USA) 094-656-8001 (Taiwan)
(I can access both through my email)
======================================
] -----Original Message-----
] From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
] tutor-request@python.org
] Sent: Monday, September 24, 2001 11:01 AM
] To: tutor@python.org
] Subject: Tutor digest, Vol 1 #1105 - 4 msgs
]
]
] Send Tutor mailing list submissions to
] tutor@python.org
]
] To subscribe or unsubscribe via the World Wide Web, visit
] http://mail.python.org/mailman/listinfo/tutor
] or, via email, send a message with subject or body 'help' to
] tutor-request@python.org
]
] You can reach the person managing the list at
] tutor-admin@python.org
]
] When replying, please edit your Subject line so it is more specific
] than "Re: Contents of Tutor digest..."
]
]
] Today's Topics:
]
] 1. Re: python newbie need help (Rino Mardo)
] 2. Re: python newbie need help (Ignacio Vazquez-Abrams)
] 3. my web site (alan.gauld@bt.com)
] 4. Re: python newbie need help (Andrei Kulakov)
]
] --__--__--
]
] Message: 1
] Date: Mon, 24 Sep 2001 00:17:00 +0800
] From: Rino Mardo <rmardo@yahoo.com>
] To: cruciatuz <sasoft@gmx.de>, tutor@python.org
] Subject: Re: [Tutor] python newbie need help
]
]
] --VbJkn9YxBvnuCH5J
] Content-Type: text/plain; charset=us-ascii
] Content-Disposition: inline
] Content-Transfer-Encoding: quoted-printable
]
] On Sat, Sep 22, 2001 at 12:56:29PM -0400 or thereabouts, cruciatuz wrote:
] >=20
] <...snipped...>
] > #!/usr/bin/env python
] >=20
] > def faktor(a,b):
] > while b !=3D 0:
] > a, b =3D b, a % b
] > return a
] >=20
] > if __name__ =3D=3D '__main__': # checks if the script is
] started as main
] > print faktor(13, 55) # calls the function faktor(a, b)
] > =09
] thanks Stefan for that bit of info. i have managed to make it work
] and have actually moved on to accepting arguments from the command
] line.
]
] for my first actual python project i'm thinking of a utility to
] archive my mails stored in a Maildir mailbox. however, i'm finding it
] difficult to find any reference as to what is the syntax should be for
] most of python's modules. take for example "os.system("cd "+dirName)"
] the language reference nor the library has no mention of what the
] syntax should for that command. should i put a comma to separate the
] arguments or no comma at all? i think what i'm looking for something
] similar to the syntax diagram of pascal.
]
] is there something similar in python?
]
] --=20
] "GUIs normally make it simple to accomplish simple actions and impossible
] to accomplish complex actions." --Doug Gwyn (22/Jun/91 in
] comp.unix.wiza=
] rds)
]
] --VbJkn9YxBvnuCH5J
] Content-Type: application/pgp-signature
] Content-Disposition: inline
]
] -----BEGIN PGP SIGNATURE-----
] Version: GnuPG v1.0.6 (GNU/Linux)
]
] iD8DBQE7rgr88JtvN2Ncyp0RArWpAJ96nwTN4uEiCiv7CDin9U3kEHPw7ACfSSam
] DssuYhCyx3wHYTyHY7fxcN0=
] =xdxn
] -----END PGP SIGNATURE-----
]
] --VbJkn9YxBvnuCH5J--
]
] _________________________________________________________
] Do You Yahoo!?
] Get your free @yahoo.com address at http://mail.yahoo.com
]
]
]
] --__--__--
]
] Message: 2
] Date: Sun, 23 Sep 2001 12:29:19 -0400 (EDT)
] From: Ignacio Vazquez-Abrams <ignacio@openservices.net>
] To: <tutor@python.org>
] Subject: Re: [Tutor] python newbie need help
]
] On Mon, 24 Sep 2001, Rino Mardo wrote:
]
] > for my first actual python project i'm thinking of a utility to
] > archive my mails stored in a Maildir mailbox. however, i'm finding it
] > difficult to find any reference as to what is the syntax should be for
] > most of python's modules. take for example "os.system("cd "+dirName)"
] > the language reference nor the library has no mention of what the
] > syntax should for that command. should i put a comma to separate the
] > arguments or no comma at all? i think what i'm looking for something
] > similar to the syntax diagram of pascal.
]
] Well, here's the railroad diagram for os.system() if you really want it:
]
] ---<shell command>--->
]
] os.system() actually runs its command in a subshell, so it may
] not be what
] you're looking for. Try os.chdir() instead.
]
] --
] Ignacio Vazquez-Abrams <ignacio@openservices.net>
]
]
]
] --__--__--
]
] Message: 3
] From: alan.gauld@bt.com
] To: tutor@python.org
] Date: Sun, 23 Sep 2001 17:36:58 +0100
] Subject: [Tutor] my web site
]
] Apologies to anyone trying to access my web tutor - Crosswinds'
] server has died again. Normal service will be resumed(*) ASAP.
]
] Maybe sooner if I can get round to moving the site to a new
] provider... but since I go on vacation tomorrow I doubt it!
]
] Alan G
]
] (*)Apparently they are going to reload FreeBSD. Dunno what
] they had been using but they seem distinctly unimpressed!
]
]
] --__--__--
]
] Message: 4
] Date: Sun, 23 Sep 2001 12:37:40 -0400
] From: Andrei Kulakov <sill@optonline.net>
] Subject: Re: [Tutor] python newbie need help
] To: tutor@python.org
] Reply-to: ak@silmarill.org
]
] On Mon, Sep 24, 2001 at 12:17:00AM +0800, Rino Mardo wrote:
] > On Sat, Sep 22, 2001 at 12:56:29PM -0400 or thereabouts,
] cruciatuz wrote:
] > >
] > <...snipped...>
] > > #!/usr/bin/env python
] > >
] > > def faktor(a,b):
] > > while b != 0:
] > > a, b = b, a % b
] > > return a
] > >
] > > if __name__ == '__main__': # checks if the script is started as main
] > > print faktor(13, 55) # calls the function faktor(a, b)
] > >
] > thanks Stefan for that bit of info. i have managed to make it work
] > and have actually moved on to accepting arguments from the command
] > line.
] >
] > for my first actual python project i'm thinking of a utility to
] > archive my mails stored in a Maildir mailbox. however, i'm finding it
] > difficult to find any reference as to what is the syntax should be for
] > most of python's modules. take for example "os.system("cd "+dirName)"
] > the language reference nor the library has no mention of what the
] > syntax should for that command. should i put a comma to separate the
] > arguments or no comma at all? i think what i'm looking for something
] > similar to the syntax diagram of pascal.
] >
] > is there something similar in python?
]
] Well, there are examples sprinkled throughout the docs, but this one
] example that you give should be self-obvious: you pass the command to run
] as an argument. Perhaps it would be easier to see if you made up the
] string before passing it:
]
] cmd = "ls " + dir
] os.system(cmd)
]
] If, on the other hand, it worked by taking in 2 arguments, one for the
] command and the other one for arguments to that command, it would
] explicitly say that it takes 2 arguments.
]
] Some modules aren't documented much because info is readily available
] elsewhere, for instance I'm looking through nntplib module and most
] commands aren't explained in detail because they are covered in nntp rfc.
]
] - Andrei
]
] --
] Cymbaline: intelligent learning mp3 player - python, linux, console.
] get it at: cy.silmarill.org
]
]
]
] --__--__--
]
] _______________________________________________
] Tutor maillist - Tutor@python.org
] http://mail.python.org/mailman/listinfo/tutor
]
]
] End of Tutor Digest
]