Robot Framework

Append to file

to extend the content of an existing file use the built-in Append To File keyword of the built-in OperatingSystem library.

*** Settings ***
Library    OperatingSystem


My Task
    Append To File
    ...    path=my_file.txt
    ...    content=my appended content
    ...    encoding=UTF-8    # default encoding can be omitted
    # using positional arguments:
    Append To File    my_file.txt    another new line

If the file does not exist a new file is created.

Related