Discuss / Python / 作业

作业

Topic source

s凡s

#1 Created at ... [Delete] [Delete and Lock User]
def to_timestamp(dt_str, tz_str):
    return datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S').replace(tzinfo=timezone(timedelta(hours=int(re.match(r'UTC([\+\-][\d]{1,2}):[\d]{1,2}', tz_str).group(1))))).timestamp()

  • 1

Reply