Home
/
Python 3.11
/
Built-in Types
/
encode
Python 3.0
Python 3.9
Python 3.11
Functions
ID
EN
…
Built-in Types
encode
Python 3.11
Return the string encoded to bytes.
Syntax
PYTHON
Copy
str.encode(encoding='utf-8', errors='strict')
See Also
bytes
Standard Encodings
UnicodeError
codecs.register_error()
Error Handlers
Python Development Mode
debug build
Python Development Mode