"""
This program is use for storing some personal information about all the people I have met before.
Or maybe it can contain information about some events relative to them
This program is built for studying how to code
So it have to be very secret
"""
import sys
from sys import argv
script, information_file = argv
##################################################################
##################################################################
"""This Is The Beginning Of List Defination"""
name = []
age = []
job = []
phone = []
email = []
list_info = []
"""End Of List Defination"""
##################################################################
##################################################################
##################################################################################################################
"""OBJECT ORIENTED PROGRAMMING"""
class Information():
def __init__(self, name, age, job, phone, email):
self.name = name
self.age = age
self.job = job
self.phone = phone
self.email = email
"""END OF OBJECT ORIENTED PROGRAMMING"""
###################################################################################################################
"""PYTHON DEFINE"""
def All(counter):
print "DO YOU WANT TO SHOW ALL INFORMATION ABOUT THESE OBJECTS ?"
CHOICE = raw_input(">>> ")
if CHOICE == "No":
Printing_Information(counter)
elif CHOICE == "Yes":
print ""
for i in range(counter):
print "*" * 70
print "Name Of Object Is: ", list_info[i].name
print "Age Of Object Is: ", list_info[i].age
print "Object's Job Is: ", list_info[i].job
print "Object's Phone Number Is: ", list_info[i].phone
print "Object's Email Is: ", list_info[i].email
print "*" * 70
print ""
print ""
print "IT IS DONE !"
print "PRESS ENTER TO EXIT."
raw_input()
sys.exit(0)
def Printing_Information(counter):
print ""
print "LIST OF OBJECT IS BELOW."
for i in range(counter):
print "OBJECT %d IS: " % (i), list_info[i].name
print "WHICH OBJECT WOULD YOU LIKE TO CHOOSE ?"
CHOICE = int(raw_input(">>> "))
for i in range(counter):
if CHOICE == i:
print ""
print "*" * 70
print "Name Of Object Is: ", list_info[i].name
print "Age Of Object Is: ", list_info[i].age
print "Object's Job Is: ", list_info[i].job
print "Object's Phone Number Is: ", list_info[i].phone
print "Object's Email Is: ", list_info[i].email
print "*" * 70
Checking()
def Checking():
print ""
print "DO YOU WANT TO CONTINUE ? \n"
CHOICE = raw_input(">>> ")
if CHOICE == "No":
print "SYSTEM IS LOGGING OUT."
raw_input()
sys.exit(0)
elif CHOICE == "Yes":
Printing_Information(counter)
else:
print "WRONG INPUT PLEASE TRY AGAIN !!!"
Checking()
def Upgrade(information_file):
target = open(information_file, 'a')
#################################
print ""
print "*" * 30
print "NAME OF OBJECT: "
Name = raw_input(">>> ")
print "AGE OF OBJECT: "
Age = raw_input(">>> ")
print "OBJECT'S JOB: "
Job = raw_input(">>> ")
print "OBJECT'S PHONE NUMBER: "
Phone_number = raw_input(">>> ")
print "OBJECT'S EMAIL: "
Email = raw_input(">>> ")
print "*" * 30
print ""
#################################
target.write(Name)
target.write("\n")
target.write(Age)
target.write("\n")
target.write(Job)
target.write("\n")
target.write(Phone_number)
target.write("\n")
target.write(Email)
target.write("\n")
target.close()
def Delete(information_file):
print "DO YOU WANT TO DELETE THIS ???"
Choice = raw_input(">>> ")
if Choice == "Yes":
target = open(information_file, 'w')
target.truncate()
elif Choice == "No":
pass
else:
print "PLEASE CHECK AGAIN !"
print ""
Delete(information_file)
"""END OF PYTHON DEFINE"""
####################################################################################################################
####################################################################################################################
####################################################################################################################
"""MAIN CODE"""
print "*" * 70
print "\nTHIS PROGRAM WAS DEVELOPED BY NIGHT FOX \n"
print "ALL DATA IN THIS PROGRAM IS USE FOR STUDYING AND IT IS PERSONAL \n"
print "PLEASE DO NOT OPEN OR CRACK OR USE MY PASSWORD TO OPEN THIS \n"
print "*" * 70
DEFAULT_PASSWORD = "1120"
print ""
print "ENTER THE PASSWORD TO CONFIRM. \n"
RAW_PASSWORD = raw_input(">>> ")
print ""
print "*" * 70
if RAW_PASSWORD != DEFAULT_PASSWORD:
print ""
print "THE PASSWORD IS WRONG."
print "PRESS ENTER TO EXIT."
raw_input()
sys.exit(0)
else:
print "ENTER PASSWORD SUCCESSFUL."
print ""
Delete(information_file)
print "HOW MANY PERSONS DO YOU WANT TO ADD ?"
n = int(raw_input('>>> '))
for i in range(n):
Upgrade(information_file)
target = open(information_file, 'r')
counter = 0
while True:
get_info = target.readline()
name.append(get_info)
get_info = target.readline()
age.append(get_info)
get_info = target.readline()
job.append(get_info)
get_info = target.readline()
phone.append(get_info)
get_info = target.readline()
email.append(get_info)
counter += 1
if not get_info:
break
counter = counter - 1
target.close()
for i in range(counter):
Person = Information(name[i], age[i], job[i], phone[i], email[i])
list_info.append(Person)
All(counter)
"""END OF MAIN CODE"""
####################################################################################################################
####################################################################################################################