ma = re.match(r'\Aimooc[\w]*','iimoocpython') 这句话里面\A加和不加没区别,用这里例子来说明\A的作用不合适。差评
2016-06-27
TypeError: cannot use a string pattern on a bytes-like object
python3 以后需要改为
response = urllib.request.urlopen(url)
buf = response.read()
buf = buf.decode('utf-8')
python3 以后需要改为
response = urllib.request.urlopen(url)
buf = response.read()
buf = buf.decode('utf-8')
2016-06-24
最新回答 / 闻过轩
f = open(str(i)+'.jpg','w')改成f = open(str(i)+'.jpg','wb'),wb是以二进制形式写入就可以了,这样就不会出现乱码了。
2016-06-09
最赞回答 / welwel
windows的话可以这样指定路径 path = 'E:\\python\\' path += str(i) + '.jpg' print (path) f = open(path,'wb')Linux的话这样path = '/tmp/' + str(i) +'.jpg'f=open(path,'w')
2016-06-06