-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword Manager.py
More file actions
58 lines (42 loc) · 1.31 KB
/
Copy pathPassword Manager.py
File metadata and controls
58 lines (42 loc) · 1.31 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
import os.path
# checks to see if the info file exists in the directory where the
# python file is located. If not it creates one.
def checkExistence():
if os.path.exists('info.txt'):
pass
else:
file = open('info.txt', 'w')
file.close()
# Write to file
def appendNew():
# adds new password in the text file.
file = open('info.txt', 'a')
print()
print()
# takes input from the user about their username, password, and the website
userName = input('Enter your user name: ')
password = input('Enter your password: ')
website = input('Enter the website address (URL): ')
# extra spacing
print()
print()
# 3 string variables to store the username, password, and website
usrnm = 'UserName: ' + userName + '\n'
pwd = 'Password' + password + '\n'
web = 'Website' + website + '\n'
# writes to the file
file.write('----------\n')
file.write(usrnm)
file.write(pwd)
file.write(web)
file.write('----------\n')
file.write('\n')
file.close
# Output the password
# opens the file and reads it
# creates a new variable to store the contents of the file
def readPasswords():
file = open('info.txt', 'r')
content = file.read()
file.close()
print(content)