<分区>
In [3]: pwd
Out[3]: u'/Users/aarcher/Desktop/scripts'
In [5]: subprocess.call(['mkdir', '-p', os.path.expanduser('~/file/path/name')])
Out[5]: 0
我在另一个终端中验证它已成功创建/Users/aarcher/file/path/name,但无法更改到该目录,即使它返回 0:
In [7]: subprocess.call(['cd', os.path.expanduser('~/file/path/name')], shell=True)
Out[7]: 0
In [8]: pwd
Out[8]: u'/Users/aarcher/Desktop/scripts'
我在 unix 盒子里