# count_lines

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/paste_collapse/count_lines)

Return the number of newline characters in `text`.

## Signature

```python
count_lines(
    text: str,
) -> int
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | `str` | Yes | The text to count newlines in. |

## Returns

`int`

The number of `\n` occurrences (0 for single-line text).

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/7794b61a6e76230e8c7a49bdce808b3728305914/libs/code/deepagents_code/paste_collapse.py#L40)