import boto3 ec2 = boto3.resource("ec2") import function function.list_instances() while True: print "\n 1. Create \n 2. Start \n 3. Stop \n 4. Terminate \n 5. Exit \n" inp = input("Choose options shown above: ") print "" if inp == 1: function.create() elif inp == 2: function.start() elif inp == 3: function.stop() elif inp == 4: function.terminate() elif inp == 5: function.list_instances() print "\n!!! Thank you !!! See you Again !!!\n" break else: print "!!! Dear Customer Kindly Choose correct option !!!!!"
from function import showMenu, create, remove, show, update n = 1 while n > 0: showMenu() n = int(input('Үйдлийн дугаар оруулна уу: ')) if n == 1: show() elif n == 2: create() elif n == 3: remove() elif n == 4: update() else: print('Та программаас гарлаа...') break
import function as s #creation s.create("Rishi",26) #creation of key with no time s.create("qwerty",1) s.create("Sai",30,3600) #creation of key with time in secs #reading s.read("Rishi") #returns key in JSON format s.read("sai") #returns key in JSON format if the time not completed else it returns an message s.create("Rishi",50) #returns an error message since the key_name already exists #deleting s.delete("Rishi") #it deletes the key with memory #By using multiple threads t1=Thread(target=(create or read or delete),args=(key,value,timeout)) t1.start() t1.sleep() t2=Thread(target=(create or read or delete),args=(key_name,value,timeout)) t2.start() t2.sleep() # ............. to tn