[Tutor] Creating folders in windows...

Chris Hengge pyro9219 at gmail.com
Thu Oct 12 01:15:50 CEST 2006


Now, how would I enter this folder? lets say, to make a subfolder or create
files inside it?

I see os.chdir() but that either can't see newly created folders, or I must
use the complete path... I'm not sure which.

just created folder 'test' in current scripts directory...
os.chdir('test')
no such file or directory


Thanks again...

On 10/11/06, Chris Hengge <pyro9219 at gmail.com> wrote:
>
> I found this from a 2004 mailing on this list..
> os.path.mkdir('folder')
> Doesn't work... there is no mkdir in os.path (old style maybe?)
>
> >>> os.path.mkdir('folder')
> Traceback (most recent call last):
>
>   File "<input>", line 1, in ?
> AttributeError: 'module' object has no attribute 'mkdir'
>
>
> >>> dir(os.path)
> ['__all__', '__builtins__', '__doc__', '__file__', '__name__', 'abspath', 'altsep',
>
> 'basename', 'commonprefix', 'curdir', 'defpath', 'devnull', 'dirname', 'exists',
> 'expanduser', 'expandvars', 'extsep', 'getatime', 'getctime', 'getmtime', 'getsize',
> 'isabs', 'isdir', 'isfile', 'islink', 'ismount', 'join', 'lexists', 'normcase',
>
> 'normpath', 'os', 'pardir', 'pathsep', 'realpath', 'sep', 'split', 'splitdrive',
> 'splitext', 'splitunc', 'stat', 'supports_unicode_filenames', 'sys', 'walk']
>
> Anyways... could someone please point me in the right direction?
>
> I can use os.system('md test'), but that isn't cross platform...
> Hopefully nothing is wrong with my python installation.
>
> Thanks!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061011/5ad7ec74/attachment.html 


More information about the Tutor mailing list