'my laptop runs win square brackets in format strings can name list (and other sequenceoffsets to perform indexingtoobut only single positive offsets work syntactically within format stringsso this feature is not as general as you might think as with expressionsto name negative offsets or slicesor to use arbitrary expression results in generalyou must run expressions outside the format string itself (note the use of *parts here to unpack tuple' items into individual function argumentsas we did in when studying fractionsmore on this form in )somelist list('spam'somelist [' '' '' '' ''first={ [ ]}third={ [ ]}format(somelist'first=sthird= 'first={ }last={ }format(somelist[ ]somelist[- ]'first=slast= [- fails in fmt parts somelist[ ]somelist[- ]somelist[ : 'first={ }last={ }middle={ }format(*parts"first=slast=mmiddle=[' '' '][ : fails in fmt or '{}in advanced formatting method syntax another similarity with expressions is that you can achieve more specific layouts by adding extra syntax in the format string for the formatting methodwe use colon after the possibly empty substitution target' identificationfollowed by format specifier that can name the field sizejustificationand specific type code here' the formal structure of what can appear as substitution target in format string--its four parts are all optionaland must appear without intervening spaces{fieldname component !conversionflag :formatspecin this substitution target syntaxfieldname is an optional number or keyword identifying an argumentwhich may be omitted to use relative argument numbering in and later component is string of zero or more nameor "[index]references used to fetch attributes and indexed values of the argumentwhich may be omitted to use the whole argument value conversionflag starts with if presentwhich is followed by rsor to call reprstror ascii built-in functions on the valuerespectively formatspec starts with if presentwhich is followed by text that specifies how the value should be presentedincluding details such as field widthalignmentpaddingdecimal precisionand so onand ends with an optional data type code string fundamentals