-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos_basic_02.py
More file actions
33 lines (26 loc) · 840 Bytes
/
os_basic_02.py
File metadata and controls
33 lines (26 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
@Author : Md. Shamimul Islam
@Written : 02/03/2019
@Description: python control flow
'''
"""
the operating system path is submodule of operating system module
"""
import os
#show just file name
file_name=os.path.basename('/home/Documets/Python/os_pyt_02.py')
print(file_name)
#show the directory file
folder_name=os.path.dirname('/home/Documents/Python/os_pyt_02.py')
print(folder_name)
#check a file or folder ,whether is it exist?
print(os.path.exists('/home/Documents/Python/os_pyt_02.py'))
#check a directory,whether is it exits?
print(os.path.isdir('/home/Documents/Python'))
#check a file,whether is it exists?
print(os.path.isfile('/home/Documents/Python/os_pyt_02.py'))
#join a file into a folder
dir=os.getcwd()
print(dir)
os.path.join(dir,'text_py.py')
print(os.path.exists('/home/Documents/Python/text_py.py'))