Skip to content

Instantly share code, notes, and snippets.

Last active Nov 7, 2015
What would you like to do?

In the Field Calculator:

  1. Select "Python" as your parser

  2. Check "Show code block".

  3. Paste the following into the code block

def leadZero(val):
 if len(str(val)) == 7:
  return str(0) + str(val)
  return str(val)
  1. In the bottom text block:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment