[Tutor] How to wrap this line of code?

Dick Moores rdm at rcblue.com
Wed Aug 23 08:41:20 CEST 2006


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)

Thanks very much,

Dick Moores





More information about the Tutor mailing list