File: LP6E/Chapter18/print3_kwonly.py

"Use keyword-only arguments to emulate print"
import sys

def print3(*args, sep=' ', end='\n', file=sys.stdout):
    output = ''
    first  = True
    for arg in args:
        output += ('' if first else sep) + str(arg)
        first = False
    file.write(output + end)



[Home page] Books Code Blog Python Author Train Find ©M.Lutz