I\'ve been using the following python code to format an integer part ID as a formatted part number string:
pn = \'PN-{:0>9}\'.format(id)
How about:
id = int(pn.split('-')[1])
This splits the part number at the dash, takes the second component and converts it to integer.
P.S. I've kept id
as the variable name so that the connection to your question is clear. It is a good idea to rename that variable that it doesn't shadow the built-in function.