On Sun, Aug 24, 2008 at 12:08 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> I have a specific file in the web tree that makes a database call. I
> am uncomfortable keeping the database username and password in the
> file. In PHP I usually put the database connection data in a file
> outside the web tree and use the include (http://il.php.net/include/)
> function to get the data. Is there a similar mechanism in Python? What
> do other Python programmers use?

You can use the normal file open() and read() functions to read the
username and password from a file. You can write the file as a Python
module, put it somewhere in the Python path and import it. You can use
the ConfigParser module to read an INI file...

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to