First time here? Check out the FAQ!

Ask Your Question
0

'builtin_function_or_method' object has no attribute 'split'

asked 4 years ago

werner1717 gravatar image

updated 4 years ago

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
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

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().

Preview: (hide)
link

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: 4 years ago

Seen: 5,223 times

Last updated: Oct 16 '20