File tree Expand file tree Collapse file tree 1 file changed +20
-14
lines changed
Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Original file line number Diff line number Diff line change 77
88# Description : Tests to see if the directory testdir exists, if not it will create the directory for you
99from __future__ import print_function
10- import os # Import the OS Module
10+ import os # Import the OS Module
1111import sys
1212
13- if sys .version_info .major >= 3 :
14- input_func = input
15- else :
16- input_func = raw_input
1713
18- CheckDir = input_func ("Enter the name of the directory to check : " )
19- print ()
14+ def main ():
15+ if sys .version_info .major >= 3 :
16+ input_func = input
17+ else :
18+ input_func = raw_input
2019
21- if os .path .exists (CheckDir ):#Checks if the dir exists
22- print ("The directory exists" )
23- else :
24- print ("No directory found for " + CheckDir ) #Output if no directory
25- print ()
26- os .makedirs (CheckDir )#Creates a new dir for the given name
27- print ("Directory created for " + CheckDir )
20+ CheckDir = input_func ("Enter the name of the directory to check : " )
21+ print ()
22+
23+ if os .path .exists (CheckDir ): # Checks if the dir exists
24+ print ("The directory exists" )
25+ else :
26+ print ("No directory found for " + CheckDir ) # Output if no directory
27+ print ()
28+ os .makedirs (CheckDir ) # Creates a new dir for the given name
29+ print ("Directory created for " + CheckDir )
30+
31+
32+ if __name__ == '__main__' :
33+ main ()
You can’t perform that action at this time.
0 commit comments