Python equivalent of two Perl statements

Sean 'Shaleh' Perry shalehperry at
Fri Jul 20 17:36:45 CEST 2001

On 20-Jul-2001 Kemp Randy-W18971 wrote:
> What is the equivalent of these Perl statements in Python?
> $time = scalar(localtime);
> print "This FTP request started on $time \n";

import time
now = time.ctime(time.time())
print now

time.time() returns seconds since the epoch, ctime() turns it into the string
like perl does.  There are several other interesting time printing functions in
the 'time' module.

More information about the Python-list mailing list