如何在python中创建protobuf3时间戳?

2024-06-26 00:14:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我看到有一个Timestamp对象,但它似乎不起作用。 使用Python3.6

$ pip install protobuf3

在python中:

^{pr2}$

什么也不返回。我做错什么了?在


Tags: installpip对象timestampprotobuf3pr2
1条回答
网友
1楼 · 发布于 2024-06-26 00:14:38

我想是虚拟环境的问题。它现在起作用了!在

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
>>> from google.protobuf.timestamp_pb2 import Timestamp
>>> timestamp = Timestamp()
>>> timestamp.GetCurrentTime()
>>> print(timestamp)
seconds: 1521497361
nanos: 600455000

>>>timestamp
seconds: 1521497361
nanos: 600455000

相关问题 更多 >