Note:
- Open widows D drive and open book.txt file and
type the number of lines
fin=open("D:\\book.txt","r")
fout=open("D:\\story.txt","a")
s=fin.readlines()
for j in s:
if 'a' in j:
fout.write(j)
fout.close()
fin.close()
Output:
**Write contents of book.txt and story.txt
- After executing above program open story.txt file
book.txt file
jkjhkll aa
kllkklk
twinkla jsad
story.txt
jkjhkll aa
twinkla jsad
book.txt file
jkjhkll aa
kllkklk
twinkla jsad
story.txt
jkjhkll aa
twinkla jsad
No comments:
Post a Comment