Newbie: datetime conversion question

Fredrik Lundh fredrik at
Tue Oct 17 15:00:29 CEST 2006

"kevin evans" wrote:

> I'm trying to convert some code from Ruby to Python, specifically..
> timestamp = "%08x" %
> Make a hex version of the current timestamp. Any ideas how best to do
> this in python gratefully received..

that's perfectly valid Python code, provided Time is an object that has a "now"
property which in turn has a "to_i" property.

but assuming that you don't have such an object, you can do something like:

    timestamp = "%02x" % time.time()


More information about the Python-list mailing list