You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
303 B

function_string = """
def recursive_function(parameter):
if parameter <= 0:
return
print(parameter)
recursive_function(parameter - 1)
recursive_function(parameter)
"""
# 定义参数字典
params = {'parameter': 5}
# 使用exec()执行函数字符串
exec(function_string, params)