What a weird thing !!?

Florent Ramière framiere at netcom-service.com
Sat Feb 19 06:30:24 EST 2000


Hello,

    well, i thinked about this method, it can be suitable for my project,
    but in one only way: it has to be set one time for all ...

    Is this possible ?

Thanks for reading.
Florent.
>
> >     Is there an easy way to override the print statement (i saw it one
time
> > in the news, but i can not find it)
> >
>
> You want sys.stdout.softspace:
>
> >>> print 1,;print 2
> 1 2
> >>> print 1,;sys.stdout.softspace=0;print 2
> 12
>
> It's a bit tedious to actually use, as it keeps getting reset; you
> could try this:
>
> >>> class SF:
> ...  def __init__(self,string): self.string = string
> ...  def __str__(self): sys.stdout.softspace = 0; return self.string
> ...
> >>> print SF("2"),1
> 21
>
> HTH,
> Michael





More information about the Python-list mailing list