AnsweredAssumed Answered

Format numbers in Field Calc/Python

Question asked by gpapamih on Oct 13, 2015
Latest reply on Oct 13, 2015 by gpapamih

Hi, I am new to python and I am trying to format numbers and concatenate them using python. I basically want to pad numbers with 0s. For example, 5236 should be formatted as 05236 or if it was 300, it should be 00300. I have 4 fields that I want to concatenate.

 

SSN - no formatting

Block - 5 characters

Lot - 4 characters

Qual - 5 characters

 

Here is what I have so far, Im not sure why my formatting is not working.

 

!SSN! + '-' + !BLOCK!.format(00000) + '-' + !LOT!.format(0000) + '-' + !QUAL!.format(00000)

Outcomes