Added backup to GTAwhatToBuy.py

This commit is contained in:
BarsTiger
2021-08-14 21:29:06 +03:00
parent b96d16f2ac
commit 1c8c3c4f1f

View File

@@ -1,4 +1,4 @@
import json, os
import json, os, shutil
def getkey(value, dictionary):
for key, val in dictionary.items():
@@ -97,7 +97,8 @@ while True:
print("4 - Print all items by shop")
print("5 - Print all items by price below this")
print("6 - Add new item to database")
print("7 - Exit")
print("7 - Create backup of database")
print("8 - Exit")
doing = input("Type here: ")
print()
@@ -154,6 +155,13 @@ while True:
basewrite.close()
elif doing == "7":
shutil.copy("whattobuy.database", "whattobuy.databack")
if os.path.isfile('whattobuy.databack'):
print("Backup successful")
print()
elif doing == "8":
print("---------------------------------------------------------------------")
input("To exit press Enter...")
exit()