how can I implement "cd" like shell in Python?

Sergi Pasoev s.pasoev at gmail.com
Thu Jun 28 13:09:14 CEST 2012


Do you mean to implement the cd command ? To what extent do you want to
implement it ? if what you want is just to have a script to change the
current working directory, it is as easy as this:


import sys
import os
os.chdir(sys.argv[1])

plus you could add some error-handling code.


More information about the Python-list mailing list