Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24603

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

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From Sergi Pasoev <s.pasoev@gmail.com>
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> (permalink)
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

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

how can I implement "cd" like shell in Python? Sergi Pasoev <s.pasoev@gmail.com> - 2012-06-28 15:09 +0400
  Re: how can I implement "cd" like shell in Python? Hans Mulder <hansmu@xs4all.nl> - 2012-06-28 13:33 +0200
  Re: how can I implement "cd" like shell in Python? Christian Heimes <lists@cheimes.de> - 2012-06-28 13:35 +0200
  Re: how can I implement "cd" like shell in Python? Laurent Pointal <laurent.pointal@free.fr> - 2012-06-28 19:13 +0200

csiph-web