a = random.sample.__doc__
from io import StringIO
import random
import sys
class OutputInterceptor(list):
def __enter__(self):
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
return self
def __exit__(self, *args):
self.extend(self._stringio.getvalue().splitlines())
del self._stringio
sys.stdout = self._stdout
with OutputInterceptor() as output:
help(random.sample)
print('\n'.join(output))