Python String encode() method

The string.encode() method in Python returns an encoded version of the string. The default encoding is the current default string encoding

Syntax

Parameter

Encoding: This parameter represents a String specifying the encoding to use and by default its value is UTF-8.

Errors: This parameter represents a String specifying the error method.

Return

This method returns an encoded version of the specified string.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This