Discuss / Python / 试了好多错

试了好多错

Topic source
    dt=datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S')
    tz=re.match(r'^UTC([\+|\-]\d+?)\:00$',tz_str)
    tz_dt=dt.replace(tzinfo=timezone(timedelta(hours=int(tz.group(1)))))
    ts=tz_dt.timestamp()
    return ts

  • 1

Reply