Unsubscriptable Object Help

Joined
Mar 18, 2009
Messages
1
Reaction score
0
I'm getting an error trying to parse a string. I want to split out the first number in the list but get an unsubscribtable object error. Below is the code and error message.

for i in range(0,num):
instr.write("DATA:REMOVE? 1")
temperature = instr.read()
print temperature
print type(temperature)
tt = temperature.split[',']
temp_file.write(temperature + ",")

Output:

2
+4.01660000E+01,00000000.117,101
<type 'str'>
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "C:\Python26\Scripts\Temp2.py", line 42, in __call__
return self.fun(*(self.pending + args), **kw)
File "C:\Python26\Scripts\Temp2.py", line 208, in run
self.Main()
File "C:\Python26\Scripts\Temp2.py", line 219, in Main
self.readpoints()
File "C:\Python26\Scripts\Temp2.py", line 234, in readpoints
tt = temperature.split[',']
TypeError: 'builtin_function_or_method' object is unsubscriptable

Any idea how to get the first number?

Tanks,
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top