You can easily add underscores to a Social Security Number (SSN) using a simple Python script. In this example, the SSN is formatted as one long string. The code adds underscores where appropriate:
value = value[0:3] + '_' + value[3:5] + '_' + value[5:9]
When this script is executed, an SSN of 456679123 would be transformed to 456_67_9123.
This code uses string slices to divide the SSN into substrings. For more information on slices of strings, see String Indexing and Slices.