I am working my way through Learn Python the Hard Way and am stuck on the extra credit for exercise 16. I am trying to read a file that I created using the main exercise 16. The code I wrote is as follows:
# pylint: disable-msg=C0103
""" This script reads and prints a file set from the argv """
from sys import argv
filename = argv
txt = open(filename)
print txt.read()
The file I am trying to read is:
Derp Derp
Reading this file
Will it work?
I am receiving the error: TypeError: coercing to Unicode: need string or buffer, list found but am unsure how my file is a list rather than strings.