-based interpolation as an alternative to `%` and `str.format()`, with the advantage that argument types are ignored and `safe_substitute()` avoids exceptions when values are missing. Templates can be customized by changing the `delimiter` and `idpattern` class attributes, or by overriding the `pattern` regular expression entirely. The module also supplies the `Formatter` class for subclassing the `str.format()` layout language, plus constants describing ASCII and numeric character sets.","keywords":"The `string` module's role in modern Python, `capwords()` for capitalizing words, `string.Template` interpolation and delimiter escaping, `substitute()` versus `safe_substitute()`, Customizing templates with `delimiter` and `idpattern`, Overriding the template `pattern` regular expression, The `Formatter` class, ASCII and numeric character constants","about":[{"@type":"Thing","name":"The `string` module's role in modern Python"},{"@type":"Thing","name":"`capwords()` for capitalizing words"},{"@type":"Thing","name":"`string.Template` interpolation and delimiter escaping"},{"@type":"Thing","name":"`substitute()` versus `safe_substitute()`"},{"@type":"Thing","name":"Customizing templates with `delimiter` and `idpattern`"},{"@type":"Thing","name":"Overriding the template `pattern` regular expression"},{"@type":"Thing","name":"The `Formatter` class"},{"@type":"Thing","name":"ASCII and numeric character constants"}],"teaches":["Explain why the `string` module still exists even though many of its functions moved to `str` methods.","Use `capwords()` to capitalize all words in a string and describe the equivalent split/capitalize/join procedure.","Write a `string.Template` with `$var` and `${var}` placeholders, including correctly escaped `$` delimiters.","Choose between `substitute()` and `safe_substitute()` based on whether missing values should raise a `KeyError`.","Customize a template subclass by setting `delimiter` and `idpattern`, or by overriding `pattern` with a new regular expression containing the four required named groups.","Identify the constants provided by the `string` module and state the limitation on their use with non-ASCII Unicode text."],"learningResourceType":"Study guide","educationalUse":"Self-study","inLanguage":"en","isBasedOn":{"@type":"CreativeWork","url":"https://pymotw.com/3/string/index.html","name":"string - Text Constants and Templates ¶"},"publisher":{"@type":"Organization","name":"Ollie","url":"https://ollie.academy"},"isPartOf":{"@type":"WebSite","name":"Ollie","url":"https://ollie.academy"}}