# write()

say it: **“RYTE”** **/ˈraɪt/**

Puts text into an open file.

## What does `write()` do?

`write()` puts text into an open file. It doesn't add a new line for you, so include `\n` where you want one.

```python
with open("todo.txt", "w") as file:
    file.write("Buy milk\n")
    file.write("Call mom\n")
```

Level: Apprentice · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=2)

Updated: November 17, 2026

Source: https://www.ask-codey.com/glossary/write
