用pycharm运行一小段爬虫的代码出现问题
11:58 Error running __init__: Cannot start process, the working directory 'E:\PyProgram\spider1' does not exist
网上找了很多都没解决,用其他IDE并不会出现这种情况,请问大神们怎么解决?
下面是我的代码(代码应该没问题把,毕竟其他IDE没出现问题
import urllib2
url = 'http://www.baidu.com'
print 'method one:'
response1 = urllib2.urlopen(url)
print response1.getcode()
print len(response1.read())
print 'method two:'
#header = ()
request = urllib2.Request(url)
request.add_header("user-agent", "Mozilla/5.0")
response2 = urllib2.urlopen(request)
print response2.getcode()
print len(response2.read())
网上找了很多都没解决,用其他IDE并不会出现这种情况,请问大神们怎么解决?
下面是我的代码(代码应该没问题把,毕竟其他IDE没出现问题
import urllib2
url = 'http://www.baidu.com'
print 'method one:'
response1 = urllib2.urlopen(url)
print response1.getcode()
print len(response1.read())
print 'method two:'
#header = ()
request = urllib2.Request(url)
request.add_header("user-agent", "Mozilla/5.0")
response2 = urllib2.urlopen(request)
print response2.getcode()
print len(response2.read())
...全文
相关推荐
【python实现网络爬虫(18)】Pycharm下载安装步骤,项目配置与运行详解
总之,PyCharm作为强大的Python IDE,对于网络爬虫的开发提供了极大的便利。从下载安装到项目配置,再到实际运行,每一步都有清晰的指导。
基于Selenium的网络爬虫分析与实现.pdf
网络爬虫,又被称为网页蜘蛛、网络机器人,是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本。爬虫可以分为通用爬虫、聚焦网络爬虫、增量式网络爬虫、深层网络爬虫等类型。
实验01-搭建Python网络爬虫开发环境.docx
实验01的主要目标是搭建一个完整的Python网络爬虫开发环境,包括配置代码编辑器、设置运行环境、安装必要的框架和组件以及学会使用HTTP抓包工具。以下是对这些内容的详细说明:1.
网络爬虫(一) 前言
而通过编写网络爬虫,我们可以准确、高效地获取并处理这些数据,确保数据的正确性和完整性。【PyCharm与爬虫开发】PyCharm 是一款强大的 Python 开发集成环境,特别适合进行网络爬虫的编写。
网络爬虫实例
一个Python开发的爬虫实例,可用于学习网络爬虫技术新手快速理解


新手乐园
