python
fofabu2
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
pymongo中如何生成ObjectId
引用from bson import ObjectId就可以啦。如:#encoding:utf-8import pymongofrom bson import ObjectIddbconnection=pymongo.Connection('localhost',27017)db = dbconnection.testcoll = db.userd=coll.find_one({'_id':转载 2018-01-03 18:16:38 · 7641 阅读 · 0 评论 -
Python执行js脚本,调用node.js
python有个库PyExecJS 安装: $ pip install PyExecJS 或者 $ easy_install PyExecJS调用:>>> import execjs>>> execjs.eval("'red yellow blue'.split(' ')")['red', 'yellow', 'blue']>>> ctx = execjs.compile("""..转载 2018-01-03 18:20:21 · 9814 阅读 · 0 评论 -
python中判断一个文件是否存在
你可以使用os.path.isfile,如果存在,它会返回True.如下: import os.path os.path.isfile(fname) 或者使用os.path.exists: import os.path os.path.exists(file_path)isfile和exists有一些区别,isfile判断是否是文件,exists判断文件是否转载 2018-01-05 17:51:31 · 2840 阅读 · 0 评论
分享