print(''this is line-feed in both and strictly speakingoutputs may in some cases differ in more than just extra enclosing parentheses in if you look closely at the preceding resultsyou'll notice that the strings also print with enclosing quotes in only this is because objects may print differently when nested in another object than they do as top-level items technicallynested appearances display with repr and top-level objects with str--the two alternative display formats we noted in here this just means extra quotes around strings nested in the tuple that is created for printing multiple parenthesized items in displays of nested objects can differ much more for other object typesthoughand especially for class objects that define alternative displays with operator overloading-- topic we'll cover in part vi in general and in particular to be truly portable without enabling prints everywhereand to sidestep display difference for nested appearancesyou can always format the print string as single object to unify displays across versionsusing the string formatting expression or method callor other string tools that we studied in print('% % % ('spam''ham''eggs')spam ham eggs print('{ { { }format('spam''ham''eggs')spam ham eggs print('answerstr( )answer of courseif you can use exclusively you can forget such mappings entirelybut many python programmers will at least encounterif not write code and systems for some time to come we'll use both __future__ and version-neutral code to achieve / portability in many examples in this book use python print function calls throughout this book 'll often make prints version-neutraland will usually warn you when the results may differ in xbut sometimes don'tso please consider this note blanket warning if you see extra parentheses in your printed text in xeither drop the parentheses in your print statementsimport prints from the __future__recode your prints using the version-neutral scheme outlined hereor learn to love superfluous text why you will careprint and stdout the equivalence between the print operation and writing to sys stdout is important it makes it possible to reassign sys stdout to any user-defined object that provides the same write method as files because the print statement just sends text to the sys stdout write methodyou can capture printed text in your programs by assigning sys stdout to an object whose write method processes the text in arbitrary ways assignmentsexpressionsand prints