Discuss / Python / 第二个assert折腾了我不少时间

第二个assert折腾了我不少时间

Topic source

greatzues

#1 Created at ... [Delete] [Delete and Lock User]
def to_timestamp(dt_str, tz_str):
    dt = datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S')
    utc_dt = dt.replace(tzinfo=timezone(timedelta(hours = int(re.split(r'[C\:]',tz_str)[1]))))
    utc_dt_timestamp = utc_dt.timestamp()
    return utc_dt_timestamp

  • 1

Reply