Python equivalent of two Perl statements

Carel Fellinger cfelling at iae.nl
Thu Jul 26 20:45:14 EDT 2001


Kemp Randy-W18971 <Randy.L.Kemp at motorola.com> wrote:
...
> 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

or any of these fine printing lines:

  print  "This FTP request started on %(time)s \n" % locals()
  print  "This FTP request started on %(time)s \n" % {"time": time}
  print  "This FTP request started on %s \n" % time

-- 
groetjes, carel



More information about the Python-list mailing list