python format inverse

Solutions on MaxInterview for python format inverse by the best coders in the world

showing results for - "python format inverse"
Alex
22 Jan 2017
1>>> import parse
2>>> format_string = 'PN-{:0>9}'
3>>> id = 123
4>>> pn = format_string.format(id)
5>>> pn
6'PN-000000123'
7>>> parsed = parse.parse(format_string, pn)
8>>> parsed
9<Result ('123',) {}>
10>>> parsed[0]
11'123'
12
similar questions
queries leading to this page
python format inverse