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?

From Sergi Pasoev <s.pasoev@gmail.com>
Newsgroups comp.lang.python
Subject how can I implement "cd" like shell in Python?
Date 2012-06-28 15:09 +0400
Organization Aioe.org NNTP Server
Message-ID <87pq8jsnfp.fsf@gmail.com> (permalink)

Show all headers | 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