'append content to end of file using mmap

I am using mmap to append some content to end of the file.

with open(str(Path().resolve().parent)+"file_name+".txt", "r+b") as f:
        s = mmap.mmap(f.fileno(), 0)
        s.seek(2) // Need to know what needs to be passed here to set the pointer to end of file 
        s.write(bytes("content_to_be_appended", encoding= 'utf-8'))   
        s.close()

How do I achieve this? Thank you in advance !!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source