This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add password read and write functionality
- Loading branch information
1 parent
68a9f45
commit 6629787
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from . import metadata | ||
|
||
DATA_FILE = metadata.DATADIR_PATH + "data.txt" | ||
|
||
def save_data(website, password): | ||
data = metadata.DATA_SEPARATOR.join([website, password]) | ||
with open(DATA_FILE, "a") as f: | ||
f.write(data + '\n') | ||
|
||
def load_data(): | ||
data_list = [] | ||
with open(DATA_FILE) as f: | ||
data = f.read() | ||
for dataitem in data.split("\n"): | ||
data_list.append(dataitem.split(metadata.DATA_SEPARATOR)) | ||
return data_list[:-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters