bd55e6b77c8efa4ebe4a5f2cae2bc9aa0d6b1c3a,Hotel-Management.py,,modify,#,128
Before Change
print("")
Room=(input("Enter your Room Number: "))
file1 = open("Management.txt", "r")
contents = file1.read()
dictionary = eval(contents)
file1.close()
listt=dictionary["Room"]
index=int(listt.index(Room))
After Change
def modify():
File=open("Management.txt","r")
string=File.read()
string = string.replace("\"", "\"")
dictionary=json.loads(string)
File.close()
dict_num=dictionary.get("Room")
dict_len=len(dict_num)
if dict_len==0:
print("")
print("There is no data in our database")
print("")
menu()
else:
print("")
Room=(input("Enter your Room Number: "))
listt=dictionary["Room"]
index=int(listt.index(Room))
print("")
print("1-Change your first name")
print("2-Change your last name")
print("3-Change your phone number")
print("")
choice=(input("Enter your choice: "))
print("")
File=open("Management.txt","w",encoding="utf-8")
if choice == str(1):
user_input=input("Enter New First Name: ")
listt1=dictionary["First_Name"]
listt1[index]=user_input
dictionary["First_Name"]=None
dictionary["First_Name"]=listt1
File.write(str(dictionary))
File.close()
elif choice == str(2):
user_input = input("Enter New Last Name: ")
listt1 = dictionary["Last_Name"]
listt1[index] = user_input
dictionary["Last_Name"] = None
dictionary["Last_Name"] = listt1
File.write(str(dictionary))
File.close()
elif choice == str(3):
user_input = input("Enter New Phone Number: ")
listt1 = dictionary["Phone_num"]
listt1[index] = user_input
dictionary["Phone_num"] = None
dictionary["Phone_num"] = listt1
File.write(str(dictionary))
File.close()
print("")
print("Your data has been successfully updated")
exit_menu()
def search():
File=open("Management.txt","r")
string=File.read()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 25
Instances
Project Name: geekcomputers/Python
Commit Name: bd55e6b77c8efa4ebe4a5f2cae2bc9aa0d6b1c3a
Time: 2021-02-12
Author: Utkarshshail005@protonmail.com
File Name: Hotel-Management.py
Class Name:
Method Name: modify
Project Name: geekcomputers/Python
Commit Name: bd55e6b77c8efa4ebe4a5f2cae2bc9aa0d6b1c3a
Time: 2021-02-12
Author: Utkarshshail005@protonmail.com
File Name: Hotel-Management.py
Class Name:
Method Name: remove
Project Name: geekcomputers/Python
Commit Name: bd55e6b77c8efa4ebe4a5f2cae2bc9aa0d6b1c3a
Time: 2021-02-12
Author: Utkarshshail005@protonmail.com
File Name: Hotel-Management.py
Class Name:
Method Name: search