[Tutor] some questions - from a complete newbie

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Fri, 14 Dec 2001 13:52:44 -0800 (PST)

On Fri, 14 Dec 2001 vip333d@yahoo.com wrote:

> I'm a newbie, and there are some things that I want to
> do with python, that aren't in the basic web tutorials
> I have read. My OS is win95. I:
> a) cannot execute the os.access(c:\.....) or the
> os.path.exists. the arrow points on the "c". I tried
> it without the c:\ and the arrow pointed on the "s" of
> "my documents.

Can you show us the error message in more detail?  Usually, the error
underneath shows where Python starts getting confused, but the message
itself is also an important debugging tool.

As a wild guess, I'm guessing that you're trying:


Python allows things like:

>>> def square(x): return x * x
>>> square(square(square(10)))

That is, we can call functions within functions --- we can call commands
within commands.  One consequence about this is that Python will assume
that something like "c:\foobar.txt" looks like a command that should be
executed.  To get it to not try to execute "c:\foobar.txt", we have to
quote it:


Quoting in Python is somewhat analogous to quoting in a human language: we
use quotes to make sure no one tries to interpret them as our own words.  
Same principle.

> b) I'd like some strings that open other windows files, documents and
> web pages etc.

Not quite sure about this one.  There's a module called "webbrowser":


that will automatically get either IE or Netscape to open an url that you
give it, so that might be useful.  I haven't played with it too much yet.

> c) I'd be happy to get a list of orders that get me parts of web
> pages, for example the headlines of the NYTimes.

This is possible --- many websites support a protocol called RSS:


and I'm very sure that there are Python modules out there that can handle

> d) It would be great to get a list of web-oriented orders, but if it's
> too much to ask - it's too much to ask.

You might be interested in Useless Python:


There should be some scripts there that demonstrate CGI programming.

Good luck to you!