首页 / PYTHON / python小知识点
python小知识点
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了python小知识点,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1741字,纯文字阅读大概需要3分钟。
内容图文
![python小知识点](/upload/InfoBanner/zyjiaocheng/857/64a76069773d49f589acc77c80339bb3.jpg)
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:\Users\Administrator\.IntelliJIdea2017.2\config\plugins\python\helpers 修改此路径(当前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)
内容总结
以上是互联网集市为您收集整理的python小知识点全部内容,希望文章能够帮你解决python小知识点所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。