[Tutor] How to wrap this line of code?

Bob Gailer bgailer at alum.rpi.edu
Wed Aug 23 19:31:17 CEST 2006


Dick Moores wrote:
> 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)
>>     
And remember that triple quoted strings include newline characters.
>
> Thanks for both those great ideas!
>
> Dick Moores
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   


-- 
Bob Gailer
510-978-4454



More information about the Tutor mailing list