[Tutor] How to wrap this line of code?
Dick Moores
rdm at rcblue.com
Wed Aug 23 11:16:34 CEST 2006
At 12:48 AM 8/23/2006, Alan Gauld wrote:
> here's another thing to consider:
>
>Since its too long for your code its probably too long for your
>display too, so think about where you would like the line break
>to be on the final print. Put in a newline character there and
>put the line break there.
>
>Alternatively use triple quoting to format the string nicely and
>then use the variable in the print statement:
>
>longstr = """
>Initial integer of first sequence with
>number of terms of %d or more was %s (%d)
>"""
>
>print longstr % (length, intCommas(n_for_max_c), n_for_max_c)
Thanks for both those great ideas!
Dick Moores
More information about the Tutor
mailing list