1 回答

TA貢獻1860條經驗 獲得超8個贊
我很抱歉。請忽略這個問題。我犯了一個小錯誤,將三重引用的注釋放在代碼另一部分的函數中。它禁用了有效傳遞的參數。
從下面刪除三重引用評論后,我只得到英文結果:
for google_url in search(query, # The query you want to run
, # User interface language (host language)
num_results = 10, # Number of results per page
lr="lang_en" # Langauge of the documents received
'''
lr - parameter is implemented in __init__.py of googlesearch
It should be handled only here.
Other useful search parameters not used yet are:
cr - restricts search results to documents originating in a particular country.
(ex. cr=countryCA)
gl - boosts search results whose country of origin matches the parameter value.
(ex. gl=uk)
'''
):
添加回答
舉報