Wednesday, June 10, 2009

python tidbits

1. How to change the working directory in python:

import os
os.chdir( )


2. How to add a directory to the module search path from within the interpreter. (Note: I like running stuff and testing new things in the interpreter. This tidbit enables me to test out modules I'm writing without having to modify the PYTHONPATH environment variable).

import sys
sys.path.append( )


No comments: