FormatTemplate¶
-
class
utilipy.utils.string.
FormatTemplate
(s)[source]¶ Bases:
string.Template
Make Template with string in Template, not
format
, syntax.Examples
>>> s = FormatTemplate('$a ${b} {c}') >>> s.format(a=1, b=2, c=3) '1 2 3'
Make Template with string in Template, not
format
, syntax.Examples
>>> re.sub(r"(?<!\$)({)", r"${", '$a ${b} {c}') '$a ${b} ${c}'
Attributes Summary
Methods Summary
format
(*args, **kw)Format str.
Attributes Documentation
-
pattern
= re.compile('\n \\$(?:\n (?P<escaped>\\$) | # Escape sequence of two delimiters\n (?P<named>(?a:[_a-z][_a-z0-9]*)) | # delimiter and a Python identifier\n {(?P<braced>(?a:[_a-z][_a-z0-9, re.IGNORECASE|re.VERBOSE)¶
Methods Documentation
-