为啥这么报错= = ValueError: chr() arg not in range(256)
C:\Python27\python.exe E:/download/python/crawler.py
Traceback (most recent call last):
File "E:/download/python/crawler.py", line 26, in <module>
from pdfminer.converter import PDFPageAggregator
File "C:\Python27\lib\site-packages\pdfminer\converter.py", line 4, in <module>
from .pdfdevice import PDFTextDevice
File "C:\Python27\lib\site-packages\pdfminer\pdfdevice.py", line 2, in <module>
from .utils import mult_matrix, translate_matrix
File "C:\Python27\lib\site-packages\pdfminer\utils.py", line 212, in <module>
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
File "C:\Python27\lib\site-packages\pdfminer\utils.py", line 180, in <genexpr>
PDFDocEncoding = ''.join( chr(x) for x in (
ValueError: chr() arg not in range(256)
可以啊,我用谷歌试过,没有问题。你没有写其他浏览器的兼容代码,所以有问题能实现就行,不过你和题目要求还是有点差别哦~你可以在进行优化一下,没有点击的时候标签下有一条线的,你可以把这个优化掉
我也遇到了同样的问题,且装的是pdfminer
utils.py里面的chr(x)改成unichr(x)即可
卸载pdfminer3k,装pdfminer2
Traceback (most recent call last):
File "C:\Users\Administrator\PycharmProjects\python\baike\spider_main.py", line 33, in <module>
obj_spider.craw(root_url)
File "C:\Users\Administrator\PycharmProjects\python\baike\spider_main.py", line 20, in craw
new_urls,new_data=self.parser.parse(new_url,html_cont)
TypeError: 'NoneType' object is not iterable
检查了地址会不会返回NONE 没错啊感觉
奇怪了
看不到代码,但是看起来并不会有问题:
#!/usr/bin/env python # -*- coding: utf-8 -*- str = "-" re = str.join(chr(x) for x in range(10)) print(re)