Python Write Result To File. Instead what you would want is. This function puts the given text in a single line.
Print MyFile element MyFileclose The file outputtxt is opened in writing mode. Write and Writelines. In this example first I opened the text file with r argument value for mode ie.
Instead what you would want is.
Print row fwritesn strrow If you use the with context it. This function puts the given text in a single line. Comma seperated value file csv Json file json Text file txt Pickle file pkl You could also write to a SQLite database. MyList New York London Paris New Delhi MyFileopen outputtxtw for element in MyList.