Write File

# write_file.py
def write_file(file_path, content):
    with open(file_path, 'w') as file:
        file.write(content)

if __name__ == "__main__":
    file_path = '/tmp/output.txt'  # Replace with your file path
    content = "Hello, this is a test."
    write_file(file_path, content)
    print(f"Content written to {file_path}")

Backlinks