【问题标题】:getQuery() How to in python [closed]getQuery()如何在python中[关闭]
【发布时间】:2013-04-06 23:52:15
【问题描述】:

我无法理解如何执行此操作。这样做的目的是对该函数进行不同的模块调用,使其返回正确的 url,然后将其下载并从中提取内容。

getQuery(location) 返回一个包含 GET 查询的 URL,用于从 wunderground.com 检索给定位置的天气。

例如,getQuery('Princeton, WV') 返回 URL

http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=Princeton%2C+WV

【问题讨论】:

  • 你的问题不清楚。请添加一些关于什么是问题和什么不起作用的信息。
  • 你用的是什么库?你想完成什么/什么不起作用?
  • 给它一本字典? {'getkey' : 'value'}
  • 来吧。现在您要针对作业中的每个功能提出一个单独的问题?

标签: python get python-3.3


【解决方案1】:
def getQuery(location):
   # return your root url plus the location encoded using quote_plus
   # http://docs.python.org/2/library/urllib.html#urllib.quote_plus
   pass

【讨论】:

    猜你喜欢
    • 2012-09-27
    • 1970-01-01
    • 2013-01-10
    • 1970-01-01
    • 2022-01-22
    • 2013-03-11
    • 2015-09-30
    • 2013-04-10
    • 2015-10-12
    相关资源
    最近更新 更多