Is there a way to globally set the print function separator?
John Black
jblack at nopam.com
Mon Oct 9 16:40:42 EDT 2017
In article <mailman.52.1507567528.12137.python-list at python.org>,
__peter__ at web.de says...
>
> John Black wrote:
>
> > I want sep="" to be the default without having to specify it every time I
> > call print. Is that possible?
>
> No, but you can replace the print function with your own:
>
> >>> print = functools.partial(print, sep="")
> >>> print("I", "recommend", "you", "choose", "another", "name", "and",
> "preserve", "your", "sanity")
> Irecommendyouchooseanothernameandpreserveyoursanity
>
> And everybody else's.
print=functools.partial(print, sep="")
NameError: name 'functools' is not defined
John Black
More information about the Python-list
mailing list