Skip to content

Commit 088e402

Browse files
author
Jarosław
authored
Update create_dir_if_not_there.py
setting up path safely python3 compatible
1 parent c1f6d15 commit 088e402

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

create_dir_if_not_there.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import os # Import the OS module
1212
try:
1313
home = os.path.expanduser("~") # Set the variable home by expanding the users set home directory
14-
print home # Print the location
14+
print(home) # Print the location
1515

16-
if not os.path.exists(home + '/testdir'):
17-
os.makedirs(home + '/testdir') # If not create the directory, inside their home directory
18-
except Exception, e:
19-
print e
16+
if not os.path.exists(os.path.join(home, 'testdir0123')):
17+
os.makedirs(os.path.join(home, 'testdir0123')) # If not create the directory, inside their home directory
18+
except Exception as e:
19+
print(e)

0 commit comments

Comments
 (0)