Given a dictionary:
data = [{'id':'1234','name':'Jason','pw':'*sss*'}, {'id':'2345','name':'Tom','pw': ''}, {'id':'3456','name':'Art','pw': ''}, {'id':'2345','name':'Tom','pw':'*sss*'}]
I need to find that pw always contains '' or *sss* .
I tried to do this:
for d in data: if d['pw'] == ['*sss*' or ''] print "pw verified and it is '*sss*' or '' " else: print "pw is not any of two'*sss*' or ''"
Please help me fill this out. I need to find that pw always contains ' ' or '*sss*' .
If possible, I need to do this on one line.
source share