idiom for RE matching

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Jul 26 04:53:36 CEST 2007


Gordon Airporte <JHoover at fbi.gov> writes:

> The actual code uses the proper 'if foo in line or if bar in line:'
> form.

    >>> line = "spam eggs ham"
    >>> foo = "spam"
    >>> bar = "sausage"
    >>> if foo in line or if bar in line:
      File "<stdin>", line 1
        if foo in line or if bar in line:
                           ^
    SyntaxError: invalid syntax

Not that I want to pick on you; I just don't want something wrong
labelled as "proper" to go unchallenged in the archives :-)

-- 
 \     "Never do anything against conscience even if the state demands |
  `\                                          it."  -- Albert Einstein |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list