need help with python syntax

Bruno Desthuilliers bdesth.quelquechose at
Thu Aug 11 23:52:00 CEST 2005

yaffa a écrit :
> dear python gurus,

One effectively needs to have some guru-powers to answer you question...

> quick question on syntax.
> i have a line of code like this
> for incident in bs('tr',  {'bgcolor' : '#eeeeee'}):
> what i want it to do is look 

Where ?

> for 'bgcolor' : '#eeeeee' or 'bgcolor' :
> 'white' and then do a whole bunch of stuff.
> i've tried this:
> for incident in bs('tr',  {'bgcolor' : '#eeeeee'} or {'bgcolor' :
> 'white'} ):  

What do you think the expression
   {'bgcolor' : '#eeeeee'} or {'bgcolor' :'white'}
evaluate to ?

(hint 1: Python has an interactive interpreter that let you test 
expressions on the fly)
(hint 2:

> but it only seems to pick up the stuff from the
> {'bgcolor' : '#eeeeee'}

Yes. That's very very True.

> any ideas folks?

1/ consider learning enough of Python to understand what you are doing.
2/ consider reading  the doc (or the source code, which is usually the 
most accurate documentation...) of 'bs()' (wherever this comes from).

Anyway, if you hope us to *guess* what it does and what args it expects 
to do it, you're just plain wrong - sorry, but we (well, I at least) 
don't have the expected psychic mind-reading skills necessary to answer 
your question without much informations.

And, BTW, the bitwise or operator (|) won't help...

More information about the Python-list mailing list