Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Problem reading data from file
#1
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.
Quote
#2
You must not show the (address of) the function, but execute the function by adding ().
print(mediaXoriginal.read())
player1681 likes this post
Quote
#3
(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.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Ignore first few letters of a line when reading file. ShakeyPakey 16 388 May-30-2020, 02:17 PM
Last Post: BitPythoner
  Reading serial data and saving to a file Mohan 1 145 May-25-2020, 04:18 PM
Last Post: pyzyx3qwerty
  Trouble reading Excel file. Shembeginner 2 230 Apr-07-2020, 04:55 AM
Last Post: Shembeginner
  Reading a json file ebolisa 2 219 Mar-15-2020, 09:24 AM
Last Post: ebolisa
  problem coverting string data file to dictionary AKNL 22 764 Mar-10-2020, 01:27 PM
Last Post: AKNL
  Reading a csv file julio2000 1 209 Feb-24-2020, 01:37 PM
Last Post: buran
  Need help with For Loop logic for reading docx Table column data vintysaw 2 511 Jan-10-2020, 06:36 AM
Last Post: vintysaw
  Create a csv file that pulls data from an .accdb file T0ky0banana 0 252 Dec-20-2019, 01:32 AM
Last Post: T0ky0banana
  Reading blob data from database by python and store it in .zip format Adityasi 2 533 Nov-18-2019, 05:22 PM
Last Post: ibreeden
  Writing list as a file, then reading that file as a list Zoastria_Balnala 3 397 Oct-17-2019, 07:54 PM
Last Post: Zoastria_Balnala

Forum Jump:


Users browsing this thread: 1 Guest(s)