在输出print(time.struct_time())上获取python数据和时间函数。TypeError:找不到必需的参数“序列”(位置1)
我只想访问]的任何特定元组项>
'time.localtime()'
输出。
在输出print(time.struct_time())上获取python数据和时间函数。 TypeError:找不到必需的参数“序列”(位置1),我只想访问“时间”的任何特定元组项。...
这是因为time.struct_time
是一个类而不是一个函数。时间模块中的几个函数,例如gmtime()
,asctime()
等,都将time.struct_time对象作为参数或将其返回。在您的情况下,time.localtime()
函数将自纪元以来经过的秒数作为参数并返回本地时间struct_time。如果未向None
传递任何参数或localtime()
,则使用time()
返回的值。