-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimport1.py
More file actions
25 lines (24 loc) · 936 Bytes
/
import1.py
File metadata and controls
25 lines (24 loc) · 936 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
import os
import sys
import datetime
print(os.path.dirname("d:\python project\import.py"))
print(os.path.basename("import6.py"))# it shows dumy file
f=os.path.exists("dict.py")
print(f)
file=sys.argv[0]
print(file)
print(os.path.isdir("d:\python project\import1.py"))#directory
print(os.path.isfile("d:\python project\import.py"))#file
print(os.path.getsize("D:\python project\pr10.py"))
print(dir(os))# gives name of dir
print(help("os"))
print(help("random "))
#os.mkdir("d:\\python project\\newfile")
#os.removedir() when inside the subfolder are not in it
#os.removedirs() it remove directory subdirectory also
#os.remove("d:\\python project\\command.py")
#os.rename("d:\\python project\\pr11.py","d:\\python project\\pr9.py")
print(os.stat("d:\\python project\\pr8.py").st_size)
print(os.stat("d:\\python project\\pr8.py").st_mtime)
date=os.stat("d:\\python project\\pr8.py").st_mtime
print(datetime.datetime.fromtimestamp(date))