How can I add items to an empty set in python

前端 未结 3 1091
猫巷女王i
猫巷女王i 2021-01-30 04:55

I have the following procedure:

def myProc(invIndex, keyWord):
    D={}
    for i in range(len(keyWord)):
        if keyWord[i] in invIndex.keys():
                      


        
3条回答
  •  灰色年华
    2021-01-30 05:23

    When you assign a variable to empty curly braces {} eg: new_set = {}, it becomes a dictionary. To create an empty set, assign the variable to a 'set()' ie: new_set = set()

提交回复
热议问题