A certainl part of an if() structure never gets executed.

Nick the Gr33k support at superhost.gr
Fri Jun 14 05:00:30 EDT 2013


On 14/6/2013 11:57 πμ, Chris Angelico wrote:
> On Fri, Jun 14, 2013 at 6:44 PM, Nick the Gr33k <support at superhost.gr> wrote:
>> Someone want to explain this?
>
> Stop writing. Start reading. It has been explained. In the course of a
> long and adventurous thread in the principal European courts, it has
> been revealed to you that ...
>
> Fill in whatever you like for the rest, it's probably all been
> revealed at some point already.
>
> ChrisA
>

Well i do not understand it.
Had to use:

		if '-' not in name + month + year:
			cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM 
clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) = 
%s ORDER BY lastvisit ASC''', (name, month, year) )
		elif '-' not in name + year:
			cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM 
clients WHERE name = %s) and YEAR(lastvisit) = %s ORDER BY lastvisit 
ASC''', (name, year) )
		elif '-' not in month + year:
			cur.execute( '''SELECT * FROM works WHERE MONTH(lastvisit) = %s and 
YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (month, year) )
		elif '-' not in year:
			cur.execute( '''SELECT * FROM works WHERE YEAR(lastvisit) = %s ORDER 
BY lastvisit ASC''', year )

to am eit work.

but i really wont to understand how 'or' and 'and' works inside an 
expression. please answer my previous post if you know.

-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list