-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiles.py
More file actions
23 lines (14 loc) · 720 Bytes
/
Copy pathfiles.py
File metadata and controls
23 lines (14 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
print(os.path.join('folder1','folder2','file.png'))
print(os.getcwd()) # current working directory
print(os.path.abspath('spam.png'))
print(os.path.dirname('/home/amit/python-playground/spam.png'))
print(os.path.basename('/home/amit/python-playground/spam.png'))
print(os.path.exists('/home/amit/python-playground/spam.pnggg'))
print(os.listdir('/home/amit/python-playground/'))
print(os.walk('/home/amit/python-playground'))
for folderName, subfolders, filenames in os.walk('/home/amit/python-playground'):
print('The folders is' + folderName)
print('The subfolders in' + folderName + 'are' + str(subfolders))
print('The filenames in' + folderName + 'are' + str(filenames))
print()