Create a Python program that takes a string and replaces all spaces with underscores.
Hello World
def replace_spaces(string):
    return string.replace(' ', '_')

string = 'Hello World'

print(replace_spaces(string))