Seems like you're trying to get Python to work like PHP, but it doesn't really do that, so you won't get magical interpretation of files.
It's been a while since I've used Dreamhost, but your best bet is probably to write your Python code and then let it run on top of Passenger. Dreamhost has some implementation details here http://wiki.dreamhost.com/Passenger_WSGI
The gist is that WSGI is a common interface between web servers and Python files so that Python files can be run upon request like you are expecting. But to get that functionality you need your Python file to implement the WSGI spec. But don't worry, it's quite easy. Just define a function named application that accepts a few ready-made parameters, and you're done.
def application(environ, start_response):
start_response('200 OK')
return 'Hi there!'
It's a bit more difficult to get at POST vars and other things, which is why you may want a framework to handle some of this stuff. Flask makes it very easy and has almost no overhead, but there are many different frameworks you could try.