def add_string():
string = ''
def add_string_inner(new_string):
nonlocal string
string += new_string
return string
return add_string_inner
messages = add_string()
print(messages('')) # 空白
print(messages('abc')) # abc
print(messages('123')) # abc123
print(messages('xyz')) # abc123xyz