• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
60 views

Problem : 

Here's my code

def defausse_rack_prov(word,rack_prov):
    word=word.get()
    for i in word:
        if i.upper() in rack_prov:
            rack_prov[rack_prov.index[i]]='' #This is the problematic line
    return rack_prov

I keep getting

TypeError: 'builtin_function_or_method' object is not subscriptable

What should I do ?

by (6.9k points)  

1 Answer

0 votes

Solution :

It Should be .index(i) - parenthesis, not brackets as shown below

e.g. def defausse_rack_prov(word,rack_prov):
     word=word.get()
     for i in word:
        if i.upper() in rack_prov:
            rack_prov[rack_prov.index(i)]='' 
     return rack_prov

Further Readings:

https://github.com/facebook/PathPicker/issues/242

by (21.9k points)  
edited by
...