Dick Moores wrote:
At 11:10 PM 8/22/2006, Bob Gailer wrote:
  
Dick Moores wrote:
    
I have this long print statement in a script:

print "Initial integer of first sequence with number of terms of %d 
or more was %s  (%d)" % (length, intCommas(n_for_max_c), n_for_max_c)

It's one line of code, and too long. How can I wrap it so that it 
is written in the code as 2 lines?

      
At least either of the following:

print "Initial integer of first sequence with number of terms of %d \
or more was %s  (%d)" % (length, intCommas(n_for_max_c), n_for_max_c)
    

Thanks! That's the one I was trying to remember.

  
print "Initial integer of first sequence with number of terms of %d",
print "or more was %s  (%d)" % (length, intCommas(n_for_max_c), n_for_max_c)
    

That first line produces the error, "TypeError: int argument 
required". Maybe this is what you meant?:
print "Initial integer of first sequence with number of terms of",
print "%d or more was %s  (%d)" % (length, intCommas(n_for_max_c), n_for_max_c)
  
Oops. I did. I thought I had split it with the %d on the 2nd line. Of course you could also fix it this way:
print "Initial integer of first sequence with number of terms of %d" % length,
print " or more was %s  (%d)" % (intCommas(n_for_max_c), n_for_max_c)
I celebrate your ability to catch and fix my mistake.
Bob Gailer
510-978-4454
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to