Python writelines() method adds a string to the file one at a time. The sequence can be any object that can be used over and over to make strings, usually a list of strings. There is no value in the return.
“a“: The texts will be inserted at the current file stream position, default at the end of the file.
“w“: The file will be emptied before the texts will be inserted at the current file stream position, default 0.