Write a method in Python to read lines from a text file DIARY.TXT, and display those lines, which are starting with an alphabet ‘P’.
Answer:
def count():
f=open("DIARY.txt",'r')
l=f.readlines()
for line in l:
if line[0]=='P':
print(line)
f.close()