1、配置python环境变量 path中添加pathon路径 2、cmd执行python -m pydoc -p 1234 1234临时端口 访问localhost:1234/ 可以查看python文档 3、关于ideal上导入第三方module File---> Project Structure--->Platform Setting--->SDKS-->Python-->Packages--> 右边+号,输入相应别的module名称进行添加 4、Elasticsearch 是一个开源的搜索引擎,建立在一个全文搜索引擎库 Apache Lucene™ 基础之上 下载地址 :https://www.elastic.co/downloads/elasticsearch 5、时间:print time.strftime("%Y-%m-%d %H:%M %p", time.localtime()) 2014-11-14 17:54 PM python 获取当前时间 import time / timestamp = int(time.time()) 当前时间毫秒数 //将时间转换为 日期 date = time.localtime(timestamp) time_format = '%Y-%m-%d %H:%M:%S' 定义日期格式 print (time_format) #打印时括号不能少 return time.strftime(time_format, date) 关于使用ideal安装第三方模块显示没有main方法是时: C:UsersAdministrator.IntelliJIdea2017.2configpluginspythonhelpers 修改此路径(当前ideal安装位置)的packaging_tool.py 中的 do_install un_install方法 ip = '127.0.0.1' port = 3306 db = 'demo' user_name = 'root' user_pass = 'root' conn = pymysql.connect(host = ip, port = port, user = user_name, passwd = user_pass, db = db, charset = 'utf8') cursor = conn.cursor() sql = "select * from test_regex" cursor.execute(sql) rows = cursor.fetchall() i = 0 for row in rows: id = row[0] url = row[1] regex = row[2] print(id) print(url) print(regex) i += 1 print("finish") client = pymongo.MongoClient('localhost', 27017) #建立和数据库系统的连接,创建Connection时,指定host及port参数 db = client.crawler db.authenticate("crawler_demo", "0305Wmph") #admin 数据库有帐号,连接-认证-切换库 #db = client.crawler #连接数据库 exchange_coll = db.www_as_exchange_com #for i in exchange_coll.find({'_id':'aaaaaaaaaaaaaaaaaaaa'}): for i in exchange_coll.find(): print(i)