Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- import getpass
- def newbook():
- fopen =open('Details.txt','a')
- now=datetime.datetime.now()
- s= now.strftime("%d-%m-%Y %I:%M:%S %p")
- fopen.write(s+'\n')
- name=raw_input("Enter the name: ")
- fopen.write(name+' ')
- address=raw_input("Enter the address: ")
- fopen.write(address+' ')
- contact=raw_input("Enter the contact no: ")
- fopen.write(contact+'\n\n')
- print "Details are added succesfully! :)"
- fopen.close()
- def searchandview():
- custname=raw_input("Enter the name of the customer for which the details are to be found: ")
- fopen=open("Details.txt")
- for detail in fopen:
- if custname in detail:
- print ("Here are the details: \n"+detail)
- #print ("No results found! Try with the correct name.")
- def deletebook():
- custname=raw_input("Enter the name of the customer for which the details are to be deleted : ")
- fopen=open("Details.txt","r+")
- output=list()
- for detail in fopen:
- if custname not in detail:
- output.append(detail)
- fopen.truncate()
- fopen.writelines(output)
- fopen.close()
- def rate():
- print ("1. Single bed-200")
- print ("2. Double bed-400")
- print ("3. Couple suite-800")
- print ("4. King suite-1200")
- while True:
- user=raw_input('Enter username: ')
- password=getpass.getpass("Enter Password: ")
- if user=='client' and password=="client123":
- break
- else:
- print "Incorrect username/password.Please try again."
- while True:
- print "Welcome to the hotel management system".center(68,'-')
- print " 1.Enter new Booking. \n 2.View saved bookings.\n 3.Delete Booking.\n 4.View Rate.\n 5.Exit."
- inp=raw_input("Choose the correct option from above:-")
- if inp=='1':
- newbook()
- elif inp=='2':
- searchandview()
- elif inp=='3':
- deletebook()
- elif inp=='4':
- rate()
- elif inp=='5':
- print "BYE!!"
- quit()
- else:
- print "Wrong input! Please try again."
Add Comment
Please, Sign In to add comment