28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Max character: x

min(str)

Description

The method min() returns the min alphabetical character from the string str.

Syntax

Following is the syntax for min() method:

min(str)

Parameters

• str -- This is the string from which min alphabetical character needs to be returned.

Return Value

This method returns the max alphabetical character from the string str.

Example

The following example shows the usage of min() method.

#!/usr/bin/python

str = "this-is-real-string-example....wow!!!";

print "Min character: " + min(str);

str = "this-is-a-string-example....wow!!!";

print "Min character: " + min(str);

Let us compile and run the above program, this will produce the following result:

Min character: !

Min character: !

replace(old, new [, max])

Description

The method replace() returns a copy of the string in which the occurrences of old have been replaced with new,

optionally restricting the number of replacements to max.

Syntax

Following is the syntax for replace() method:

str.replace(old, new[, max])

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!