I'm using someone's code in c++ which is called by python. I have no way of getting into the source code and modify it. When called with python, it prints something, and I want to assign this output to a variable. How can I do that?
def print_something(string):
print(string)
x = print_something('foo')
print(type(x))
Out[5]: NoneType
Ideally, this code would assign 'foo' to x as a string.