the str format(method returns new string with the replacement fields in its string replaced with its arguments suitably formatted for example"the novel '{ }was published in { }format("hard times" "the novel 'hard timeswas published in each replacement field is identified by field name in braces if the field name is simple integerit is taken to be the index position of one of the arguments passed to str format(so in this casethe field whose name was was replaced by the first argumentand the one with name was replaced by the second argument if we need to include braces inside format stringswe can do so by doubling them up here is an example"{{{ }}{ ;-}}format(" ' in braces"" ' not""{ ' in bracesi' not ;-}if we try to concatenate string and numberpython will quite rightly raise typeerror but we can easily achieve what we want using str format()"{ }{ }format("the amount due is $" 'the amount due is $ we can also concatenate strings using str format((although the str join(method is best for this) "threes ="{ { { } format("the" "tops" 'the three topshere we have used couple of string variablesbut in most of this section we'll use string literals for str format(examplessimply for the sake of convenience--just keep in mind that any example that uses string literal could use string variable in exactly the same way the replacement field can have any of the following general syntaxes{field_name{field_name!conversion{field_name:format_specification{field_name!conversion:format_specificationone other point to note is that replacement fields can contain replacement fields nested replacement fields cannot have any formattingtheir purpose is to allow for computed formatting specifications we will see an example of this