## encode()


Encode a string to bytes.


Usage


``` python
encode(
    data,
    encoding="utf-8",
)
```


## Parameters


`data: str`  
The string to encode.

`encoding: str = ``"utf-8"`  
The target encoding.


## Returns


`bytes`  
The encoded bytes.
