Tobias Quezada wrote: > hello community,i am a newbie to python and program in general. > the script below works in python 2.7.3 on windows but not in the python > 2.7.3 ubuntu terminal. > >>>>fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file >>>>pointer.I am using windows 7 and it works but on ubuntu 12.04 LTS i get >>>>this syntax error: > Traceback (most recent call last): File "<stdin>", line 1, in > <module>IOError: [Errno 2] No such file or directory: 'prez.dat' That was probably
> fp=open("prez.dat","r") > x=fp.read > print(x) > i used fp for file pointer.I am using windows 7 and it works but on ubuntu > 12.04 LTS i get this syntax error: > Traceback (most recent call last): File "<stdin>", line 1, in > <module>IOError: [Errno 2] No such file or directory: 'prez.dat' > Any thoughts?Thanx Please reread the error message. This is not a SyntaxError. Python is trying to tell you that a file called "prez.dat" doesn't exist in the current working directory. However, once you create the file (or provide the complete path if the file exists but is located in another directory) you will run into the next problem: > x=fp.read This will bind x to the fp.read method. To call the method the parentheses are mandatory: x = fp.read() _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor