Newbie! I'm a newbie! What's wrong with this program?

Erik Max Francis max at alcyone.com
Mon Jul 21 01:40:11 CEST 2003


klappnase wrote:

> The "None" comes from:
> 
> > def newLine():
> >   print
> 
> What you meant was:
> def newLine():
>     print "\r"

No, that isn't where it comes from.

> (I must admit that I am not familiar with line endings on windoze, in
> linux it is "\n", on windoze it might be "\r" or "\r\n", I don't know
> for sure, however you don't need this function at all)

If sys.stdout is opened in text mode then '\n' will get translated to
the appropriate form regardless.  So this is a red herring you're after.

> You might try something like:
> 
> print "There are " + str(minHour(x_hours)) + " minutes in " +
> str(x_hours) + " hours"

That would still print exactly the same thing.  The problem is that
minHour is returning None (implicitly).

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ All your slick moves / They were once innocent moves
\__/  Sade




More information about the Python-list mailing list