Re: printing

Ariel Faigon (arielf@mirage.nsc.com)
Thu, 10 Feb 94 14:17:44 PST

>
> >>>>> "Lance" == lance <lance@markv.com> writes:
>
> >> What's wrong with:
> >>
> >> print a + ',', b
> >>
>
> Lance> Nothing except that the 'print a' is before a loop,
> Lance> the "print ', '" is inside the loop in an 'if' statement,
> Lance> and the 'print b' is inside that same loop....
>
> Lance> for example...
>
> Lance> print a,
> Lance> for n in <whatever>:
> Lance> if <whatever condition>:
> Lance> print ', ',
> Lance> print b,
> Lance> print ''
>
> Try this:
>
> x=a
> for n in <whatever>:
> if <whatever condition>:
> x=x+', '+b
>
> print x
>
> Cheers,
> Jose'
>
Well, since this thread is going on, I thought I'd add
my $0.02 in :-).

I guess what Lance wanted to see is a simple way to print
a string without a following space or newline.

One answer is to use os.write (?), which is not as elegant/
simple/straightforward as just 'print'.
While I like the python syntax (and many other features) better,
I wish python had the logic of Perl regarding the 'print' interface,
Namely: don't 'print' what you haven't been asked to.

Disclaimer: I'm very new to 'python'. Just watching this list.

Peace, Ariel