printing - Python: custom print function that wraps print() -
printing - Python: custom print function that wraps print() -
how can wrap print() can add together arbitrary strings origin , end of things passed arguments printed?
def xprint(*args):     print("xxx", *args, "xxx") xprint("hi", "yo", 4)    doesn't work. want custom function xprint() work print() add together 'xxx' origin , end of every output.
will work python 2 , 3
def xprint(*args):     print( "xxx"+" ".join(map(str,args))+"xxx")  in [5]: xprint("hi", "yo", 4) xxxhi yo 4xxx        python printing wrap 
 
  
Comments
Post a Comment