# uproot.serialization.string

Defined in [uproot.serialization](https://github.com/scikit-hep/uproot/blob/f1299d71fa4f435b1901386346c8a42adbd72642/src/uproot/serialization.py) on [line 20](https://github.com/scikit-hep/uproot/blob/f1299d71fa4f435b1901386346c8a42adbd72642/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.
