```
from math import sqrt
class Solution(object):
def checkPerfectNumber(self, num):
"""
:type num: int
:rtype: bool
"""
ret=[1]
for i in xrange(2,int(math.sqrt(abs(num))+1)):
if num%i==0:
ret.append(i)
ret.append(num/i)
return sum(ret)==abs(num) if num!=1 else False
```