Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Sergi Pasoev Newsgroups: comp.lang.python Subject: how can I implement "cd" like shell in Python? Date: Thu, 28 Jun 2012 15:09:14 +0400 Organization: Aioe.org NNTP Server Lines: 10 Message-ID: <87pq8jsnfp.fsf@gmail.com> NNTP-Posting-Host: MNfEkO4nzJ1srxGsEHAbhQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:tD3EuYasXuex/nzUBuLHWAhemQQ= Xref: csiph.com comp.lang.python:24603 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.