-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathone.py
More file actions
46 lines (28 loc) · 811 Bytes
/
one.py
File metadata and controls
46 lines (28 loc) · 811 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
34
35
36
37
38
39
40
41
42
43
44
45
# we can creat and read delet and appenda data in a file in Pythn i
import os
f=open("demo.txt", "r")
print(f.read())
# readline return only single line of file
q=open("demo.txt", "r")
print(q.readline())
# we can also loop all file
f=open('demo.txt',"r")
for i in f:
print(i)
# os module
# provide current directory of file
print(os.getcwd())
# change current directory chdir()
# we have move to that file
print(os.chdir("/home/hamza/Desktop/PythonPractice"))
# lsit file and folders in a folder listdir()
# we can also access the files from the other dirctorie and folders
# current folder path
a=os.getcwd()
print(a)
# move to differtn files
print(os.chdir("/home/hamza/Desktop/PythonPractice"))
print(os.uname())
print(os.ctermid())
print(os.stat("one.py"))
os.system("firefox")