Discuss / Python / 作业

作业

Topic source

云端67395

#1 Created at ... [Delete] [Delete and Lock User]

def to_timestamp(dt_str, tz_str): cday = datetime.strptime(dt_str,'%Y-%m-%d %H:%M:%S') m = re.match(r'([\w]+?)([\d+-]+)([:\d]+)',tz_str) dt = cday.replace(tzinfo=timezone(timedelta(hours=int(m[2])))) return dt.timestamp()


  • 1

Reply