'helloworld str( 'helloworld repr( "'helloworld 'str( / ' 'the value of is repr( 'and is repr(yprint(sthe value of is and is the repr(of string adds string quotes and backslasheshello 'helloworld\nhellos repr(helloprint(hellos'helloworld\nthe argument to repr(may be any python objectrepr((xy('spam''eggs'))"( ('spam''eggs'))the string module contains template class that offers yet another way to substitute values into stringsusing placeholders like $ and replacing them with values from dictionarybut offers much less control of the formatting formatted string literals formatted string literals (also called -strings for shortlet you include the value of python expressions inside string by prefixing the string with or and writing expressions as {expressionan optional format specifier can follow the expression this allows greater control over how the value is formatted the following example rounds pi to three places after the decimalimport math print( 'the value of pi is approximately {math pi 'passing an integer after the ':will cause that field to be minimum number of characters wide this is useful for making columns line up table {'sjoerd' 'jack' 'dcab' for namephone in table items()print( '{name: =={phone: }'sjoerd == jack == dcab == other modifiers can be used to convert the value before it is formatted '!aapplies ascii()'!sapplies str()and '!rapplies repr()animals 'eelsprint( 'my hovercraft is full of {animals'my hovercraft is full of eels print('my hovercraft is full of {animals ! 'my hovercraft is full of 'eelsfor reference on these format specificationssee the reference guide for the formatspec input and output