The encode() method in Python String is known to return an encoded version of the string. The current default string encoding is the default encoding. The errors might be given to a set of varied error handling schemes.
str.encode(encoding='UTF-8',errors='strict')
Decoded string.
#!/usr/bin/python str = "this is string example....wow!!!"; print "Encoded String: " + str.encode('base64','strict')
Encoded String: dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE=
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.