Indentation in Python counts. This may seem odd at first, but it goes a long way to making Python programs some of the easiest programs to maintain.
Every block structure -- control structures, classes, functions, etc. -- must be indented the same number of times for their level in the program. Convention is to use four spaces (without tabs) for each level of indentation. So, a skeletal structure of a Python program might look like this:
import os, re, string
def test_function1():
def test_function2():
class CartoonCharacter(object):
def main():
a = 8
string = "sunshine"
if x == 1:
if x != 1:
if a > 0:
while b < 100:
elif a == 0:
else:
else:
if __init__ == "__main__":
main()
