Is this a BUG?

Thomas Wouters thomas at xs4all.net
Thu Dec 28 06:57:37 EST 2000


On Thu, Dec 28, 2000 at 10:48:14AM +0100, QdlatY wrote:
> Hello!
> 
> I have script:
> ----------------
> import cgi
> 
> form = cgi.FieldStorage()
> 
> print form
> print "!",form["index"].value,"!"
> ------------------
> I launched it with parameter index=1
> And this is an output:
> ----------------
> FieldStorage(None, None, [MiniFieldStorage('index', '1')])
> ! 1 !
> ----------------
>  ^ ^
> Why the hell there are spaces? index property has value '1'!
> not ' 1 '?!

>>> print "!",1,"!"
! 1 !

It's the space inherit in the system. (See the documentation for 'print' --
it's supposed to do that :) You have to forcibly oppress it to avoid the
space:

>>> print "!%s!"%1
!1!

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list