Str.format will return formatted version of given string. String can be formatted using ‘{}’.'{}’will be replaced by given element as shown below.

a=’1234{}6{}’

a.format(‘5′,’7’)

Output:

'1234567'
'{}'is replaced by given numbers .
str.format in python
Str.Format

 

By SC

Leave a Reply

Your email address will not be published. Required fields are marked *