这是python中的代码,不起作用且动机未知。
import json, urllib2
url = 'http://twitter.com/#!/search/PAROusuariosSUBTE'
server = urllib2.urlopen(url)
js = json.load(server)
res = js['results']
for espDeRes in res:
espDeRes['from_user']
espDeRes['text']
这是控制台中的错误。
Traceback (most recent call last):
File "pro.py", line 4, in <module>
js = json.load(server)
File "/usr/lib/python2.6/json/__init__.py", line 267, in load
parse_constant=parse_constant, **kw)
File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.6/json/decoder.py", line 338, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
任何的想法?
谢谢。