On Wed, Jul 6, 2016 at 10:59 AM <loh...@tuta.io> wrote: > why do I have to create a variable txt_again to assign it to the open > function and them print the file? > why is it that I can't only write something like open(file_again).read()? >
Good insight. In fact you don't need to create the variable. The code ``data = open('filename').read()`` will open the file named "filename" in the current working directory, read it, and assign the data to a variable. However, many programmers use variables not because they must, but because good variable names can make code easier to read. Also, doing less stuff on a line of code can make that code easier to read. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor