# uproot.serialization.string

Defined in [uproot.serialization](https://github.com/scikit-hep/uproot5/blob/d216ae6a2ea5436d9b53a615b9c023860a545c11/src/uproot/serialization.py) on [line 20](https://github.com/scikit-hep/uproot5/blob/d216ae6a2ea5436d9b53a615b9c023860a545c11/src/uproot/serialization.py#L20).

### uproot.serialization.string(data)

Converts a Python string into bytes, ready to be written to a file.

If the string’s byte representation (UTF-8) has fewer than 255 bytes, it
is preceded by a 1-byte length; otherwise, it is preceded by `b'ÿ'` and a
4-byte length.
