-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ5.py
More file actions
29 lines (23 loc) · 768 Bytes
/
Q5.py
File metadata and controls
29 lines (23 loc) · 768 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
f = open(r'C:\Users\adars\OneDrive\Documents\PYTHON\Python class 12\Filehandling\Q5.txt','r')
g = open(r'C:\Users\adars\OneDrive\Documents\PYTHON\Python class 12\Filehandling\Q5.txt','a')
def fn():
u = input('Enter username:')
p = input('Enter password:')
s = ' '
while s:
e = f.readline()
if e == u + "," + p:
print("Welcome ",u)
break
else:
g = open(r'C:\Users\adars\OneDrive\Documents\PYTHON\Python class 12\Filehandling\Q5.txt','a')
g.write("\n" + u + "," + p)
break
while True:
q = input("Dp you want to log in? (y/n):")
if q == "y":
fn()
if q == "n":
break
f.close()
g.close()