用python计算昨天,今天,明天的日期是这个格式么?

1个回答

  • Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32

    Type "copyright", "credits" or "license()" for more information.

    >>> import datetime

    >>> today = datetime.date.today()

    >>> oneday = datetime.timedelta(days=1)

    >>> yesterday = today - oneday

    >>> tommorrow = today + oneday

    >>> print yesterday, today, tommorrow

    2011-06-02 2011-06-03 2011-06-04

    >>>

    哪个版本的python? 不应该