[Tutor] Cosmetic question about printing
Dick Moores
rdm at rcblue.com
Wed May 7 02:54:01 CEST 2008
At 05:41 PM 5/6/2008, Kent Johnson wrote:
>On Tue, May 6, 2008 at 5:41 PM, Dick Moores <rdm at rcblue.com> wrote:
>
> >
> > The function is now:
> >
> >
> > def printResult(date1, date2, days1, weeks, days2):
> > print "\nThe difference between %s and %s is %d days" %
> (date1.strftime("%m/%d/%Y"),
> > date2.strftime("%m/%d/%Y"), days1)
> > line1 = "\nThe difference between %s and %s is %d days" %
> ((date1.strftime("%m/%d/%Y"), date2.strftime("%m/%d/%Y"), days1))
>
>There is no need to compute this string twice, just use
> line1 = ...
> print line1
Oh, of course. Thanks for pointing that out.
Dick
More information about the Tutor
mailing list