How to make an enemy follow the player in pygame using vectors and rect?

  pygame, python

class player(object):

def init(self, x, y, width, height):

 self.walkRight = [ list of images]

 self.walkLeft = [list of images]

 self.walkDown = [list of images]

 self.walkUp = [list of images]

#get rect for each image using list comprehension. I do this 4 times for each arrow key

 self.rect_Right = [img.get_rect() for img in 
 self.walkRight] #repeat for other arrows

class enemy(object):

(basically the same thing as player with enemy images)

def move_towards_player(self, player):

I am running into 2 problems. 1st, since I am uploading multiple images into a list, I don’t know whether I am using the get_rect() correctly. I am currently using a list comprehension. How do I get the rect.x and rect. y positions? How do I get the center position?

2nd, I don’t know how to get the move_towards_player to get working. I passed the player class into the function, but I don’t think it can read the rects.

Source: Python Questions