Python Forum
Problem reading data from file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Problem reading data from file (/thread-27008.html)



Problem reading data from file - player1681 - May-22-2020

I am trying to read a simple colum vector as

mediaXoriginal = open('posx_mean_no_acoplo_tf_multiple.txt', 'r') 
and then

print(mediaXoriginal.read)
However, the resulting output is

Output:
<built-in method read of _io.TextIOWrapper object at 0x0000018430573EA0>
The file, posx_mean_no_acoplo_tf_multiple.txt only has numbers and I need to have a vector to later use an interpolation function.

Any help is appreciated.

Thanks.


RE: Problem reading data from file - ibreeden - May-22-2020

You must not show the (address of) the function, but execute the function by adding ().
print(mediaXoriginal.read())



RE: Problem reading data from file - player1681 - May-22-2020

(May-22-2020, 08:17 AM)ibreeden Wrote: You must not show the (address of) the function, but execute the function by adding ().
print(mediaXoriginal.read())

EDIT: I have found the syntax error. Your answer works fine. Thanks.