是否可以将以下内容string
转换为字典或json
对象:
{“created_at”:“Thu Feb 19 11:28:52 +0000 2009”,“description”:“Le p\u00f4le de comp\u00e9titivit\u00e9 de la fili\u00e8re des contenus et services num\u00e9riques。http :/ /www.capdigital.com // http://www.facebook.com/capdigitalparisregion ", "favourites_count": 7, "followers_count": 5996, "friends_count": 671, "geo_enabled": true, "id": 21290877 ,“lang”:“en”,“listed_count”:344,“location”:“Paris”,“name”:“Cap Digital”,“profile_background_color”:“920707”,“profile_background_tile”:true,“profile_image_url”: “ http://a0.twimg。com/profile_images/2263411541/cap_square_normal.png ", "profile_link_color": "0084B4", "profile_sidebar_fill_color": "http://a0.twimg.com/profile_background_images/157539330/xad3a63c73eff9ba8f89f81e01c10a4d.jpg ", "profile_text_color": "333333", "protected": false, "screen_name": "Cap_Digital", "status": {"created_at": "Mon Mar 18 16:23:05 +0000 2013", "favorited": false, "id": 313687008188956672, "retweet_count": 5, "retweeted": false, "source": "http://clocktweets.com /\" rel=\"nofollow\">Clocktweets", "text": "Plus que quelques jours avant @5Plus_Forum, conf\u00e9rence sur la ville intelligencee! http ://t.co/GV5o6fiqUh ", "截断": false},“statuses_count”:2121,“time_zone”:“巴黎”,“url”:“ http://www.capdigital.com ”,“utc_offset”:3600}
我试过json.load()
它给出了以下回溯:
Traceback (most recent call last):
File "C:\Users\schatterjee\workspace\twittermining\main.py", line 82, in <module>
treat_files()
File "C:\Users\schatterjee\workspace\twittermining\main.py", line 74, in treat_files
d = json.load(row[0])
File "C:\Python27\lib\json\__init__.py", line 274, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'