python not returning true

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Feb 14 07:05:25 EST 2007


Michael Bentley <rmcore at gmail.com> writes:

> # Something just doesn't seem right in those
> # "Every kiss begins with 'K'" commercials.
>
> >>> 'Every Kiss'.startswith('K')
> False

    >>> kisses = ["kiss", "kiss", "kiss", "kiss", "kiss"]
    >>> kisses == [kiss for kiss in kisses
    ...            if kiss.startswith("k")]
    True

Happy St. Valentine's Day, everyone.

-- 
 \             "Experience is that marvelous thing that enables you to |
  `\      recognize a mistake when you make it again."  -- Franklin P. |
_o__)                                                            Jones |
Ben Finney




More information about the Python-list mailing list