Python text mining -


i have function get_numbers('x') runs bing search find contact number 'x', i.e. get_numbers('google') return customer service contact number. want extend search running bing search on different forms of company name. , run loop run get_numbers on versions of name.

def company_names(company):     etc =['','ltd','plc', 'inc']     names = [ '{} {}'.format(company,i) in etc ]     return names  def get_more_numbers(company):      company = company_names(company)     in company:         name = company[i]         get_numbers(name) 

i'm getting error:

  file "<ipython-input-22-716ce1744cc0>", line 5, in get_more_numbers     name = company[i]  typeerror: list indices must integers, not str 

you cannot have string indices. iterating using each of string. i contain name. not index. can remove line.

name = company[i] 

and replace next line get_numbers(i)


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -