[Tutor] Help me Be Pythonic

Chris Lott chrisl@frodo.thethirdsector.com
Tue, 28 May 2002 16:38:00 -0800


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have started to learn Python and written my first little app
that takes a file of names (or a list on the command line) and
checks to see which of the .com/.org/.net/.info domains are
available using urllib to grab data from web forms.

However, my code is very procedural. No functions and no objects
of my own.

In pseudo code, how can I think about this task like a python
programmer. Would I have a urlcheck object that was passed the
data and checked for different types? What's the pythonic way
to:

open file or command line arguments
    check url for .com
    if text found print "succes" 
    else print "unavailable"
    check url for .org
    if text found print "succes" 
    else print "unavailable"

etc?

c

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (MingW32) - GPGshell v2.30
Comment: Key ID: 0x51046CFD

iD8DBQE89CLk1oth6FEEbP0RAmMAAJ9n6hFJsBIo7K12ct5mwHAG8tlpMACff5BI
rZr6OR2br+PeSAayUtYucL0=
=0Fyc
-----END PGP SIGNATURE-----