Python String method Obscured -



Python String method Obscured -

i'm trying split string returned python implementation of interactive broker's api, maintain getting a:

attributeerror: 'tickprice' object has no attribute 'split' def my_price_handler(msg): fields=msg.split() print fields[0]

checked api code , (1) msg string , (2) 'split' not redefined elsewhere. msg string looks <tick cost tickerid=1, field=1, price=74.0, canautoexecute=1> , can printed console directly. same error message when using syntax:

def my_price_handler(msg): fields=string.split(msg) print fields[0]

i have imported string @ top of program.

is variable scope issue?

clearly, msg not string when enters my_price_handler; it's tickprice. put

print(type(msg))

before split phone call convince of fact.

(the fact msg can printed not mean it's string, if that's thought.)

python string

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -