Ok it's been about 2 weeks and no replies, so I guess nobody else knows what this stuff means either. Also, I've noticed that as I search around for python related stuff, the more it really seems to be a niche language (on the web)... its growing fast I guess, but still has a very limited userbase and its hard to find tutorials & other info when compared to something like PHP (but I guess that's true for most languages).
Here's what I've been able to find out:
I've seen from a couple of sources now that...
...is in fact just for use on a Unix based system. It automatically tracks down the python interpreter wherever it is filed away, making your scripts more portable when jumping from machine to machine. So unless you use Linux (or some other Unix OS) and expect your code to be jumping around to other unfamiliar Unix OS computers, then you can just leave this out of your programs.
These special characters:
%s '/' r'.*'
...I'm still not sure about. So far, it looks like the %s is some kind of substitution character for strings in python.
For example: "The %s went up the tree" % cat
the '/' looks like its just a way for the main page in that path to refer to itself, but really not sure.
and I think the r'.*' means: r = read-only, . = this type, * = all
So in this case its "all files" and specifies read-only access (but, again, I'm not sure about this).
And last is this:
if __name__ == "__main__":
main () (or whatever executes your script in place of "main()")
...which looks like it has to do w/ modules. As I've read more about python, modules look to be an important and powerful way to, well, modularize your code and keep from having to rewrite the same code over and over, or even from having to include all of a program's code, all in one huge file.
According to what I've read, the reason for having this code at the bottom of all your python scripts is to give those files the ability to be used as modules if needed, but not allowing them to automatically execute that code unless they are themselves the "main" file. That way you don't get imported modules auto-executing code on their own, when they shouldn't. If the are imported into another file, and therefore not the "main", then the ' if ' statement won't let them execute. If they are run standalone, they then become the "main" and are executed by the ' if ' statement automatically. It's basically an autorun ' off ' switch if imported, and an ' on ' switch if run by themselves. That's pretty cool.
You don't have to use it, but it's probably good practice to include it in all your script files as you develop a larger base of reusable code modules, and you start wanting to import them to various programs.
Obviously, I'm still a noob at all this, but so far python looks like a great language - much cleaner and straight forward w/o all those brackets and semicolons to keep track of and get in the way.
The main stumbling block so far is finding info geared at noobs. Almost everything seems to be written by experienced programmers, for experienced programmers, so it's a bit harder to get into than some other languages... this probably limits wider adoption, which in turn limits the available entry-level info.
Anyway, I hope this helps someone.