are roughly as simple to use as ' function the next section uncovers the way that files are specified in prints print stream redirection in both python and xprinting sends text to the standard output stream by default howeverit' often useful to send it elsewhere--to text filefor exampleto save results for later use or testing purposes although such redirection can be accomplished in system shells outside python itselfit turns out to be just as easy to redirect script' streams from within the script the python "hello worldprogram let' start off with the usual (and largely pointlesslanguage benchmark--the "hello worldprogram to print "hello worldmessage in pythonsimply print the string per your version' print operationprint('hello world'hello world print string object in print 'hello worldhello world print string object in because expression results are echoed on the interactive command lineyou often don' even need to use print statement there--simply type the expressions you' like to have printedand their results are echoed back'hello world'hello worldinteractive echoes this code isn' exactly an earth-shattering piece of software masterybut it serves to illustrate printing behavior reallythe print operation is just an ergonomic feature of python--it provides simple interface to the sys stdout objectwith bit of default formatting in factif you enjoy working harder than you mustyou can also code print operations this wayimport sys printing the hard way sys stdout write('hello world\ 'hello world this code explicitly calls the write method of sys stdout--an attribute preset when python starts up to an open file object connected to the output stream the print operation hides most of those detailsproviding simple tool for simple printing tasks manual stream redirection sowhy did just show you the hard way to printthe sys stdout print equivalent turns out to be the basis of common technique in python in generalprint and sys stdout are directly related as follows this statementprint operations