Function
string.capwords

Signature

capwords(s, sep=None)

Documentation String

capwords(s, [sep]) -> string

Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. Note that this replaces runs of whitespace characters by a single space.