MCPcopy Create free account
hub / github.com/ActiveState/code / chdir

Function chdir

recipes/Python/279407_Windows_Console/recipe-279407.py:60–70  ·  view source on GitHub ↗

A simple function to change the directory. Including handling spaces, quotes etc.

(l1)

Source from the content-addressed store, hash-verified

58 return newline
59
60def chdir(l1):
61 """A simple function to change the directory.
62 Including handling spaces, quotes etc."""
63 l2 = l1
64 if l1[0] == '\"' == l1[-1]: l2 = l1[1:-1]
65 if os.path.isdir(l2):
66 os.chdir(l2)
67 elif os.path.isdir(l2.strip()):
68 os.chdir(l2.strip())
69 else:
70 print 'The system can\'t see directory ' + l1
71
72
73

Callers 5

recipe-578858.pyFile · 0.85
recipe-279407.pyFile · 0.85
create_txtsFunction · 0.85
create_diffsFunction · 0.85
recipe-579080.pyFile · 0.85

Calls 3

isdirMethod · 0.80
chdirMethod · 0.80
stripMethod · 0.45

Tested by

no test coverage detected