create_date = datetime.datetime.strptime(create_date,"%Y/%m/%d")爬取文章时抛出异常得到当天日期

def date_convert(value):
    value = value.strip().replace("·", "").strip()
    try:
        create_date = datetime.datetime.strptime(value, "%Y/%m/%d").date()
    except Exception as e:
        create_date = datetime.datetime.now().date()

    return create_date
create_date = datetime.datetime.strptime(create_date,
pwld.png

你可能感兴趣的:(create_date = datetime.datetime.strptime(create_date,"%Y/%m/%d")爬取文章时抛出异常得到当天日期)