windluffy
windluffy

Reputation: 13

How to get system time (server redis) on python

When I use Redis client console with command:

Redis-Server(Ubuntu):0>time 1) 1462519232 2) 200666

How do I can get it in python like 1462519232.200666

Version redis lib I use redis 2.10.5

Upvotes: 1

Views: 1218

Answers (1)

tanglong
tanglong

Reputation: 278

You could use third-package: redis

It supports redis's built-in time command:

>>> import redis
>>> r = redis.Redis(host='127.0.0.1', port=6379, db=0)
>>> r.time()
(1462524221, 416010)

Upvotes: 3

Related Questions