Simple Problems: Caps and Commas

KefX keflimarcusx at aol.comNOSPAM
Mon Oct 27 02:00:08 EST 2003


For case-insensitive string comparisons, just make sure both strings are
lowercase (uppercase works too, of course). You're checking against a string
literal, so you only need to make the other one lowercase. Change your 'if'
statement to this:

if string.lower(poan) == "yes":

And at the top of your module, put this:
import string

The library reference is very handy. Use it! :)

>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.

- Kef




More information about the Python-list mailing list