def isRarFile(filename):
 archive_regex = u'(?P<file>^(?P<base>(?:(?!\\.part\\d+\\.rar$).)*)\\.(?:(?:part0*1\\.)?rar)$)'
 if re.search(archive_regex, filename):
  return True
 return False

def isRarFile ( filename ) : archive_regex = u'(?P<file>^(?P<base>(?:(?!\\.part\\d+\\.rar$).)*)\\.(?:(?:part0*1\\.)?rar)$)' if re . search ( archive_regex , filename ) : return True return False
check if file is a rar file .