正则匹配时间

  1. 以下是该网页在北京时间 2018年12月24日 22:58:19 的快照;
    publish_time = response.xpath(’//[@id=“bd_snap_txt”]/span[2]/text()’)[0]
    print(publish_time)
    #匹配以上字符串中的日期,匹配数字,数字后面跟任意字符,再匹配到数字
    publish_time = re.findall(’\d.
    \d+’, publish_time)[0]
    print(publish_time)

2.匹配手机号码
/^\d{5,11}$/

你可能感兴趣的:(Python)