an example of writing list to file with each list item on new line is given below list of data values to be outputted alist [ 'one''two''three''four''five''six''seven''eight''nine''ten'open the file for writing datafile open('aseem txt'' 'loop through each item in the list and write it to the output file for eachitem in alistdatafile write(str(eachitem)+'\ 'datafile open('aseem txt',' 'print(datafile readlines()close the output file datafile close(output[' \ '' \ '' \ '' \ '' \ '' \ '' \ '' \ '' \ '' \ ''one\ ''two\ ''three\ ''four\ ''five\ ''six\ ''seven\ ''eight\ ''nine\ ''ten\ 'if we change the mode from "wto "aappend mode then the new content will be added with the existing content let' see the below example for better understanding examplelist of data values to be outputted alist [ ,datafile open('aseem txt',' 'print("data in aseem txt file before append operation"print(datafile readlines()open the file for writing datafile open('aseem txt'' 'for eachitem in alistdatafile write(str(eachitem)+'\ 'datafile open('aseem txt',' 'print("data in aseem txt file after appeand operation"page