[Tutor] OS lib creating an directory using an absolute path.
mhysnm1964 at gmail.com
mhysnm1964 at gmail.com
Sat Feb 6 13:29:30 EST 2021
Thanks all for the quick response. Michael, that is a good article.
From: Michael Deslippe <1611kjb at gmail.com>
Sent: Sunday, 7 February 2021 1:06 AM
To: mhysnm1964 at gmail.com; tutor at python.org
Subject: Re: [Tutor] OS lib creating an directory using an absolute path.
I would direct you to this article:
http://www.compciv.org/practicum/shakefiles/a-creating-a-directory-idempoten
tly/
---Mike
_____
From: Tutor <tutor-bounces+1611kjb=gmail.com at python.org
<mailto:tutor-bounces+1611kjb=gmail.com at python.org> > on behalf of
mhysnm1964 at gmail.com <mailto:mhysnm1964 at gmail.com> <mhysnm1964 at gmail.com
<mailto:mhysnm1964 at gmail.com> >
Sent: Saturday, February 6, 2021 5:33:26 AM
To: tutor at python.org <mailto:tutor at python.org> <tutor at python.org
<mailto:tutor at python.org> >
Subject: [Tutor] OS lib creating an directory using an absolute path.
All,
I am using the os library. If I have a directory structure with any missing
directory (folders), then the os.mkdir function fails as it cannot find the
filenamefilename. For example:
Current directory structure is:
C:\books with nothing inside.
The path I am wanting to create is:
E:\books\a\anne rice
Yes, I could break the path and check each level of the directory. But I was
wondering if there was any other method to do this. As if you do this at
Windows 10 command line:
Mkdir E:\books\"a\anne rice"
The 'a' directory plus 'anne rice' is also created.
I hope this makes sense. Python 3.8 under windows 10.
Sean
_______________________________________________
Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list