# libtmux.formats._escape_format

- **Module:** libtmux.formats
- **Package:** libtmux
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux/blob/d2a146c9a045437b92013d65943b7ac70013fa24/src/libtmux/formats.py#L33
- **Page:** https://libtmux.org/en/py/latest/reference/libtmux-formats-_escape_format/

```
libtmux.formats._escape_format(text: str) -> str
```

Return *text* written so that tmux expands it back to exactly *text*.

``#{a:35}`` is tmux's character-code format for ``#``. Doubling (``##``)
is not enough: tmux keeps a run of ``#`` before ``[`` as a style, so
``a#[b`` would be stored as ``a##[b``.

## Parameters

- `text` (`str`)

## Examples

```python
>>> _escape_format("build#2")
'build#{a:35}2'
>>> _escape_format("a#[b")
'a#{a:35}[b'
>>> _escape_format("50% a,b}")
'50#{a:37} a#{a:44}b#{a:125}'
>>> _escape_format("plain")
'plain'
```
