我粘貼了一小段與我的問題相關的代碼。 我傳遞一個dict
上我的課的itemSearch
方法,但我得到一個TypeError
爲什麼我在Python中打開我的** kwargs時得到TypeError
def itemsearch(self,*args,**params):
#items = self.api.item_search('Books', Publisher="O'Reilly", Author="James Shore",Year="2014",limit=10)
print args
print params
itemSearch=self.api.item_search(*args,**params)
print [item.ASIN for items in itemSearch.Items.Item]
self.listASIN=[(item.Title,item.ASIN) for items in itemSearch.Items.Item]
amazonsearch=AmazonLookup()
params={'SearchIndex':'Electronics','Condition':'New','Keywords':'Macbook pro 13 retina','MinimumPrice':'600',
'MaximumPrice':'2000','Sort':'-price'}
print params
amazonsearch.itemsearch(**params)
我得到TypeError: item_search() takes at least 2 arguments (1 given)
你能展示完整的追溯?也'item_search()'!='itemsearch()' – mhlester