-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrough.py
More file actions
64 lines (51 loc) · 1.4 KB
/
Copy pathrough.py
File metadata and controls
64 lines (51 loc) · 1.4 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
print(os.getcwd())
print(os.listdir())
# code is used to creat a file as we want write in a functions
def Nfile():
with open("hamza.js","w") as f:
f.write("console.log(`hamza Khan`)")
# Nfile()
# detaIL OS OPERATING SYSTEM
print(os.uname())
#list of process
print(os.getegid())
# usename
print(os.getlogin())
# os name
print(os.uname())
#function that copy word lendth greater than 4 and add then in a array and render that
def four():
f=open("demo.txt")
val=f.read()
line=val.split()
count=0
for i in line:
if len(i)<4:
print(i)
count+=1
else:
pass
print("total number of wors greater than 4 are ",count)
four()
# function that counter number of lower case letters in a file
def loweer():
s=open("demo.txt")
lowers=0
values=s.read()
for i in values:
if i.islower():
lowers+=1
print("Number of lower case wors in file are ",lowers)
loweer()
# a function with whic we can write or appen a file from input field
def fieldx():
a=open("demo.txt","a")
while True:
text=input("Enter any text you want to entr in demo File")
a.write("\n "+ text)
choice=input("conferm more or not y/n")
if choice=="n":
break
a.close()
fieldx()