**Code:**

```
genders=[]
      for image in os.listdir('Face'):
        try:
          gender = int(image.split('_')[1])
        except ValueError:
          pass
      genders.append(gender)

```

Trying to add int values of string in list.
Raises Value error

> 
> ValueError: invalid literal for int() with base 10: ''
> 
> 
> 

I want to catch that error and remove the file. and to keep looping.

So the idea is that i want to add those int values to list and delete the files where loop could not convert string to int

sorry for my bad English.