Programming Examples

Python program to marge the content of target file into source file


Write a Python program to accept two file name (source and Target) and copy and append the content of target file into source file.

Solution

fname1=input("Enter the Source File Name : ")
fname2=input("Enter the Target File Name : ")
fp1=open(fname1,"a")
fp2=open(fname2,"r")
data=fp2.read()
fp1.write(data)
fp1.close()
fp2.close()
Output

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz