f = open("demofile3.txt", "a")
f.writelines(["See you soon!", "Over and out."])
f.close()
# readlines and writlines simple program
def finds() :
f=open('file.txt')
s=open('destination.txt','w')
p=f.readlines()
o=[]
for i in p:
if 'S' in i.upper():
o.append(i)
s.writelines(o)
f.close()
s.flush()
s.close()
finds()
'''file.txt'''
''The life that I have
Is all that I have
And the life that I have
Is mine
The love that I have
Of the life that I have
Is mine and mine and mine.
A sleep I shall have
A rest I shall have
Yet death will be but a pause
For the peace of my years
In the long green grass
Will be mine and mine and mine.''
..............................................................................
#output:
'''destination.txt'''
..Is all that I have
Is mine
Is mine and mine and mine.
A sleep I shall have
A rest I shall have
Yet death will be but a pause
For the peace of my years
In the long green grass
Enter the name of the employee: Aditya
Enter the name of the employee: Aditi
Enter the name of the employee: Anil