小编Sti*_*ina的帖子

访问python字典

我正在编写代码,将在Twitter上搜索关键词并将它们存储在python词典中:

        base_url = 'http://search.twitter.com/search.json?rpp=100&q=4sq.com/'
        query = '7bOHRP'
        url_string = base_url + query
        logging.info("url string = " + url_string)
        json_text = fetch(url_string)
        json_response = simplejson.loads(json_text.content)                                              
        result = json_response['results']
        print "Contents"
        print result
Run Code Online (Sandbox Code Playgroud)

结果字典是:

Contents[{
    u 'iso_language_code': u 'en',
    u 'text': u "I'm at Cafe en Seine (40 Dawson Street, Dublin) w/ 2 others. http://4sq.com/7bOHRP",
    u 'created_at': u 'Wed, 06 Oct 2010 23:37:02 +0000',
    u 'profile_image_url': u 'http://a1.twimg.com/profile_images/573130785/twitterProfilePhoto_normal.jpg',
    u 'source': u '<a href="http://foursquare.com" rel="nofollow">foursquare</a>',
    u 'place': {
        u 'type': u 'neighborhood',
        u …
Run Code Online (Sandbox Code Playgroud)

python dictionary

5
推荐指数
1
解决办法
5127
查看次数

解析Android中的JSON响应

我正在为android编写一个httpget请求,查询附近事件的foursquare api.我收到的JSON响应是

{"groups": [
{
  "type": "Nearby",
  "venues": [
    {
      "id": 2587838,
      "name": "Marriott Druids Glen Hotel Newtownmountkennedy",
      "primarycategory": {
        "id": 79281,
        "fullpathname": "Travel:Resort",
        "nodename": "Resort",
        "iconurl": "http://foursquare.com/img/categories/travel/resort.png"
      },
      "address": "Newtownmountkennedy",
      "city": "Newtownmountkennedy",
      "state": "",
      "verified": false,
      "geolat": 53.091717,
      "geolong": -6.079162,
      "stats": {
        "herenow": "0"
      },
      "distance": 5596
    },
Run Code Online (Sandbox Code Playgroud)

这些场地可以有很多.我可以使用此代码打印出场地信息

InputStream instream = entity.getContent();
String result= convertStreamToString(instream);
Log.i("Hoosheer0",result);

// A Simple JSONObject Creation
JSONObject json=new JSONObject(result);
JSONArray venues = json.getJSONArray("groups");
//JSONArray docsArray = jObject.getJSONArray("docs");
for (int i = 0; i<venues.length();i++){ …
Run Code Online (Sandbox Code Playgroud)

android json foursquare

5
推荐指数
1
解决办法
1万
查看次数

在Google App引擎上使用Hunch

我想在Python中使用Hunch on Google App Engine.我需要使用哪些库来执行此操作,还是有任何可以帮助我的好的在线教程?

python google-app-engine hunch

5
推荐指数
1
解决办法
215
查看次数