Zax71
Zax71

Reputation: 29

TypeError: 'builtin_function_or_method' object is not subscriptable error in python 3

i have been having this error and cannot find a way to fix it here is my code (i am using python 3.7)

qustion = pyperclip.paste()

qustion = qustion.replace("×", "*")
qustion = qustion.replace("÷", "/")
list_qustion = qustion.split

op_func = ops[str(list_qustion[1])] # the line where the error occurs

answer = op_func(list_qustion[0], list_qustion[2])  

print(answer)

Upvotes: 0

Views: 104

Answers (1)

Tom Ron
Tom Ron

Reputation: 6181

qustion.split is a function not a list of values. What I guess you meant is -

list_qustion = qustion.split() 

or possibly with the delimiter -

list_qustion = qustion.split('.') 

Upvotes: 2

Related Questions