Answers for "python format inverse"

0

python format inverse

>>> import parse
>>> format_string = 'PN-{:0>9}'
>>> id = 123
>>> pn = format_string.format(id)
>>> pn
'PN-000000123'
>>> parsed = parse.parse(format_string, pn)
>>> parsed
<Result ('123',) {}>
>>> parsed[0]
'123'
Posted by: Guest on August-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language