any string can be turned into format string by calling the format(method on it this method returns new string where specific characters in the input string have been replaced with values provided as arguments and keyword arguments passed into the function the format method does not require fixed set of argumentsinternallyit uses the *args and **kwargs syntax that we discussed in python object-oriented shortcuts the special characters that are replaced in formatted strings are the opening and closing brace charactersand we can insert pairs of these in string and they will be replacedin orderby any positional arguments passed to the str format methodtemplate "hello {}you are currently {print(template format('dusty''writing')if we run these statementsit replaces the braces with variablesin orderhello dustyyou are currently writing this basic syntax is not terribly useful if we want to reuse variables within one string or decide to use them in different position we can place zero-indexed integers inside the curly braces to tell the formatter which positional variable gets inserted at given position in the string let' repeat the nametemplate "hello { }you are { your name is { print(template format('dusty''writing')if we use these integer indexeswe have to use them in all the variables we can' mix empty braces with positional indexes for examplethis code fails with an appropriate valueerror exceptiontemplate "hello {}you are {your name is { print(template format('dusty''writing')escaping braces brace characters are often useful in stringsaside from formatting we need way to escape them in situations where we want them to be displayed as themselvesrather than being replaced this can be done by doubling the braces for examplewe can use python to format basic java programtemplate ""public class { {public static void main(string[args{system out println("{ }")}}}""print(template format("myclass""print('hello world')"))