Make a function to print out all substrings of a given string in Python
str = "coding"
def print_substrings(str):
    for i in range(len(str)):
        for j in range(i+1, len(str)+1):
            print(str[i:j])

if __name__ == "__main__":
    str = "coding"
    print_substrings(str)