Ask Your Question
0

'builtin_function_or_method' object has no attribute 'split'

asked 2020-10-16 09:24:56 -0500

werner1717 gravatar image

updated 2020-10-16 11:39:33 -0500

Code:

import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
file = 'IV meas -1.50E+0 V to 1.50E+0 V PHY 364 Practical_Dark_temp_25.57oC_Intensity_0.000suns -light OFF- 0 sec wait at 0 Volt.txt'
f=open(file,'r')
delimiter = ','

line=f.readline()
while (line != ''):
    data=line.split(delimiter)
    V1L.append(float(data[0]))
    I1L.append(float(data[1]))
    line=f.readline

each line in the txt file is of the form

-1.50000E+0,-3.22013E-3
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-10-16 09:36:23 -0500

rburing gravatar image

Indeed if line = f.readline then line.split(delimiter) does not work, because in this case line is not a string but a method, so you cannot call split on it.

You meant line = f.readline().

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-10-16 09:24:56 -0500

Seen: 34 times

Last updated: Oct 16