[Tutor] Can't figure out why this is printing twice

Christian Witts cwitts at compuscan.co.za
Mon Jun 8 12:25:55 CEST 2009


Mike Hoy wrote:
> I have the following code:
>
> import gzip
> import datetime
> date = datetime.date.today()
> name = date.strftime('%m-%d-%Y')+'.gz'
> date.strftime('%m-%d-%Y')+'.gz'
> print "The name of the file will be", name
>
> the output is:
> The name of the file will be
> The name of the file will be 06-08-2009.gz
>
>
> I can't figure out why 'The name of the file will be' is printing 
> twice. Any help appreciated.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   
Running from a console the expected output would actually be

06-08-2009.gz
The name of the file will be 06-08-2009.gz

Other than that side effect it works with only 1 print.

-- 
Kind Regards,
Christian Witts
Data Management

C o m p u s c a n | Confidence in Credit

Telephone: +27 21 888 6000
National Cell Centre: 0861 51 41 31
Fax: +27 21 413 2424
E-mail: cwitts at compuscan.co.za

NOTE:  This e-mail (including attachments )is subject to the disclaimer published at: http://www.compuscan.co.za/live/content.php?Item_ID=494. 

If you cannot access the disclaimer, request it from email.disclaimer at compuscan.co.za or 0861 514131.



More information about the Tutor mailing list