Python 为什么time.asctime(time.gmtime())忽略GMT?

Python 为什么time.asctime(time.gmtime())忽略GMT?,python,time,gmt,Python,Time,Gmt,我想得到我当前的时间和使用时间 from time import * asctime(gmtime()) 为了这个 但是,我得到的是GMT+0时间,而不是本地时间GMT+3: ...$ ipython Python 2.7.12 (default, Nov 12 2018, 14:36:49) Type "copyright", "credits" or "license" for more information. IPython 5.8.0 -- An enhanced Interac

我想得到我当前的时间和使用时间

from time import *
asctime(gmtime())
为了这个

但是,我得到的是GMT+0时间,而不是本地时间GMT+3:

...$ ipython
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.


In [1]: from time import *; asctime(gmtime())
Out[1]: 'Tue Jul  2 12:02:06 2019'

In [2]:                                                                                                                                                                                                                          
Do you really want to exit ([y]/n)? 
...$ date
Tue Jul  2 15:02:12 IDT 2019
...$ 
如何在不手动更改从
gmtime()
返回的元组的情况下将时间调整为本地时间?

time.localtime([secs])

与gmtime()类似,但转换为本地时间。如果 未提供秒或无,时间()返回的当前时间 使用。当dst应用于给定时间时,dst标志设置为1


将asctime更改为localtime