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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -