def date(self, need_parse=True, pattern=None, attr_name=None):
     if attr_name:
         str_number = first_match(pattern, self.attr(attr_name)) if pattern else self.attr(attr_name)
     else:
         str_number = self.text(pattern)
     if not str_number:
         return None
     return parse_date(str_number) if need_parse else time.gmtime(parse_number(str_number))
Exemple #2
0
 def number(self, pattern=None, prec=0, attr_name=None):
     if attr_name:
         str_number = first_match(
             pattern,
             self.attr(attr_name)) if pattern else self.attr(attr_name)
     else:
         str_number = self.text(pattern)
     return parse_number(str_number, prec) if str_number else None
Exemple #3
0
 def date(self, need_parse=True, pattern=None, attr_name=None):
     if attr_name:
         str_number = first_match(
             pattern,
             self.attr(attr_name)) if pattern else self.attr(attr_name)
     else:
         str_number = self.text(pattern)
     if not str_number:
         return None
     return parse_date(str_number) if need_parse else time.gmtime(
         parse_number(str_number))
 def number(self, pattern=None, prec=0, attr_name=None):
     if attr_name:
         str_number = first_match(pattern, self.attr(attr_name)) if pattern else self.attr(attr_name)
     else:
         str_number = self.text(pattern)
     return parse_number(str_number, prec) if str_number else None