ip = int(input('How many entries you want to add?: '))
f = open("text.txt",'w')
f.write("{0:15s}{1:15s}{2:15s}{3:15s}".format("Enrollment","Name","Age","Email"))
for i in range(ip):
Enroll = input("Enter Enrollment number: ")
Name = input("Enter name: ")
Age = input("Enter age: ")
Email = input("Enter email-id: ")
print ('')
details = "{0:15s}{1:15s}{2:15s}{3:15s}".format(Enroll,Name,Age,Email)
f.write("\n"+details)
f = open("text.txt",'r')
print(f.read())
f.close()
f = open("text.txt",'w')
f.write("{0:15s}{1:15s}{2:15s}{3:15s}".format("Enrollment","Name","Age","Email"))
for i in range(ip):
Enroll = input("Enter Enrollment number: ")
Name = input("Enter name: ")
Age = input("Enter age: ")
Email = input("Enter email-id: ")
print ('')
details = "{0:15s}{1:15s}{2:15s}{3:15s}".format(Enroll,Name,Age,Email)
f.write("\n"+details)
f = open("text.txt",'r')
print(f.read())
f.close()
ScreenShot:
No comments:
Post a Comment