What a weird thing !!?

Michal Wallace (sabren) sabren at manifestation.com
Sat Feb 19 14:22:11 EST 2000


On Sat, 19 Feb 2000, Florent Ramière wrote:

> Hi,
> 
>     sorry for replying this message, but is what you say means that there is
>     absolutely no way to print excatly what i want to print ???
> 
>     I will never be able to display "ab" in two print ???
> 
>     That make me nervous about python !

This is a feature.

>>> print "a", "b"

is just an easy way of saying:

>>> import sys
>>> sys.stdout.write("a")
>>> sys.stdout.write(" ")
>>> sys.stdout.write("b")

so to get rid of the space:

>>> import sys
>>> sys.stdout.write("a")
>>> sys.stdout.write("b")

or:

>>> print "a" + "b"

and for numbers:

>>> a = 1
>>> b = 1
>>> print `a` + `b`   # note back-ticks

or:

>>> result = "a"
>>> result = "a" + "b"
>>> print result


Cheers,

- Michal
-------------------------------------------------------------------------
http://www.manifestation.com/         http://www.linkwatcher.com/metalog/
-------------------------------------------------------------------------





More information about the Python-list mailing list