Python Forum

Full Version: Problem reading data from file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
You must not show the (address of) the function, but execute the function by adding ().
print(mediaXoriginal.read())
(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.