Discuss / Python / 交作业

交作业

Topic source
def to_timestamp(str, quyu=None):    time = datetime.strptime(str, '%Y-%m-%d %H:%M:%S')    rex = re.compile(r'^UTC([0-9+\-]+):00$')    shiqu = int(rex.match(quyu).group(1))    c = time.replace(tzinfo=timezone(timedelta(hours=shiqu)))    return c.timestamp()

  • 1

Reply