In append (a) mode , data will be added at the end of the file. Existing data will not be overwritten.
fob=open('data1.txt','a')
fob.write("\nthis is 2nd line of text added")
You can open data1.txt and see the content inside.
To write and display
fob=open('data1.txt','a')
fob.write("\nthis is 2nd line of text added")
## Writting at the end of file is over , now read
fob=open('data1.txt','r')
print(fob.read())
fob.close()
Output is here
this is first line of text
this is 2nd line of text added
Enter name , mark in four subjects for students by creating a CSV file. A CSV file ( Comma separated value ) stores records in rows and each data is separated by comma. Here is a sample csv file data.