我正在使用 Beautiful soup 从 Weather Underground 网站中提取数据。我能够得到我想要的确切数据并将其分配给一个变量dayTemp
。但是当我尝试使用print dayTemp
. 我收到以下错误:
Traceback (most recent call last):
File "<pyshell#47>", line 1, in <module>
print dayTemp
File "C:\Python27\lib\idlelib\rpc.py", line 595, in __call__
value = self.sockio.remotecall(self.oid, self.name, args, kwargs)
File "C:\Python27\lib\idlelib\rpc.py", line 210, in remotecall
seq = self.asynccall(oid, methodname, args, kwargs)
File "C:\Python27\lib\idlelib\rpc.py", line 225, in asynccall
self.putmessage((seq, request))
File "C:\Python27\lib\idlelib\rpc.py", line 324, in putmessage
s = pickle.dumps(message)
File "C:\Python27\lib\copy_reg.py", line 74, in _reduce_ex
getstate = self.__getstate__
RuntimeError: maximum recursion depth exceeded
我span.string
用来从整个元素中获取整数值。变量的类型dayTemp
是<class 'bs4.element.NavigableString'>