|
> can't use print x anymore Yes, its a function not a statement, so its now print(x). > which also gets rid of "print x,", which printed something without making a newline, for one thing. Sure, you have to do:
print(x,end=' ') if you want to space separate things printed on separate code lines on the same output line. Of course, if the extra keystrokes bother you, its really not much one-time cost to toss together a library that provides a function that gets rid of them, while keeping the rest of the power of the print function: def p(*args, **kwargs):
kwargs = {'end': ' '}.update(kwargs)
print(*args,**kwargs)
Though if I was going to bother to do that, I'd probably do it with the same separator for multiple items on the same line as for items on different lines: def p(*args, **kwargs):
kwargs = {'sep': ' ', 'end': ' '}.update(kwargs)
print(*args,**kwargs)
or, further leveraging print-is-a-function: import functools
p = functools.partial(print, sep=' ',end=' ')
|