Making response part

Hi, i am beginner in psychopy.
I planned to make an experiment . However it doesnt work well.
Especially, in getting response part. Here is a simple explanation about my work.
I use face picture as stimulus. Participants need to press two button. if man appears, press <-, if woman appears , press ->.
I want to know how could i get this work done. Here is my work.
Please somebody help me. the stimulus files start with ‘man’,‘woman’,‘mm’,‘mw’.

imagelist = glob.glob('./face/*.png')

print imagelist

win = visual.Window([800,800], color=[-1,-1,-1], units='pix')
preFix = visual.TextStim(win, text = '+', height = 50 ,units= 'pix',color = [1,1,1])
RT = core.Clock()
grim = visual.ImageStim(win, units='pix')
result = []

for i in idx:
    preFix.draw()        # Present fixation cross
    grim.image = imagelist[i]
    print i,grim.image
    keys = []
    while len(keys) == 0:
        keys = event.getKeys(['left','right'],timeStamped=RT)
        print keys
        if grim.image = "man" or "mm" and keys = 'left':
            ansRW = 1
            print 'Correct'
        elif grim.image  = "woman" or "mw" and key = 'right':
            ansRW = 1
            print 'Correct'
            ansRW = 0
            print wrong

You need to be specific about what your problem actually is.

But as a quick pointer, you should learn what the difference between = and == is in Python (i.e. the difference between assignment and testing for equality).