Simple Qu: Changing directory
Michael Hudson
mwh21 at cam.ac.uk
Sat Jul 10 19:17:32 EDT 1999
More information about the Python-list mailing list
Sat Jul 10 19:17:32 EDT 1999
- Previous message (by thread): Longs
- Next message (by thread): Simple Qu: Changing directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Bower <nick.bower at ssec.wisc.edu> writes: > I feel really dumb asking this question, but how do I change the current > working directory? For browsing the file system I mean. > > I've found exec commands, but these would surely be device dependent and > there doesn't seem to be anything obvious in the os or os.path > documentation. i looked through the tutorials too. > > thanks in advance, nick os.chdir? as in Python 1.5.2 (#1, May 11 1999, 11:42:00) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> os.chdir('/') >>> os.getcwd() '/' >>> print os.chdir.__doc__ chdir(path) -> None Change the current working directory to the specified path. >>> os.chdir('~') Traceback (innermost last): File "<stdin>", line 1, in ? OSError: [Errno 2] No such file or directory: '~' >>> os.chdir(os.path.expand'~') os.path.expanduser os.path.expandvars >>> os.chdir(os.path.expanduser('~')) >>> os.getcwd() '/home/mwh21' >>> HTH Michael
- Previous message (by thread): Longs
- Next message (by thread): Simple Qu: Changing directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list