Simple Problems: Caps and Commas

Robert Brewer fumanchu at amor.org
Mon Oct 27 03:29:54 EST 2003


> >I tried this:
> >-----------------------------------------------
> >print "Name: ", fname, mname, lname
> >print "Address: ",saddy, ",",city, ",",state, ",",zip
> >-----------------------------------------------
> >
> >But I get extra spaces after each value:
> >"Name: Firstname , Middlename , Lastname"
> >"Address: Street Address , City , State , Zip"
> >
> >When it should look like this:
> >"Name: Firstname, Middlename, Lastname"
> >"Address: Street Address, City, State, Zip"
> 
> That's because you put extra spaces in the string. Don't do 
> that, and it will
> look right.

I keep looking, but I don't see any "extra spaces". I think it's rather
that the print command inserts spaces between arguments. If you don't
like string interpolation, try:

>>> print "Address: ", ", ".join((saddy, city, state, zip))



Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org





More information about the Python-list mailing list