The count() method in Python String returns the number of occurrences of substring sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.
- encoding − These are the encodings to be used. For a list of every encoding schemes, one shall visit the Standard Encodings.
- errors − This might be given to help set various error handling schemes. The default for the errors is strict, which signifies that encoding errors may raise a UnicodeError. Other possible values are inclusive of replace, ignore, xmlcharrefreplace, backslashreplace as well as any other name which is registered through codecs.register_error().
Str = "this is string example....wow!!!";
Str = Str.encode('base64','strict');
print "Encoded String: " + Str
print "Decoded String: " + Str.decode('base64','strict')
Encoded String: dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE=
Decoded String: this is string example....wow!!!
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.