
python
文章平均质量分 51
aircoder
这个作者很懒,什么都没留下…
展开
-
python 安装 pip beautifulsoup4
pip 安装:yum install python-setuptoolseasy_install pipbeautifulsoup4 安装:pip install beautifulsoup4原创 2013-10-25 17:50:26 · 233 阅读 · 0 评论 -
探索 Pexpect,第 2 部分:Pexpect 的实例分析
原文: http://www.ibm.com/developerworks/cn/linux/l-cn-pexpect2/技术主题软件下载社区技术讲座 developerWorks 中国Linux文档库探索 Pexpect,第 2 部分:Pexpect 的实例分析丁 钦浩 (dingqinh@cn.ibm.com), 软件开发工程师, IBM王 栋柯 (wangd...原创 2013-08-19 11:08:39 · 236 阅读 · 0 评论 -
CentOS升级Python到2.7版本
[root@localhost ~] python -V Python 2.4.31.先安装GCCyum -y install gcc2.下载Python-2.7.2[root@localhost ~] wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz23.解压Python-2.7.2...原创 2013-04-23 15:24:43 · 120 阅读 · 0 评论 -
文本文件中获取http链接
#!/usr/bin/python2.7 #coding=utf-8import sysimport MySQLdbimport timeimport hashlibimport datetimeimport jsonimport urllib2import httplib,urllibimport zimreload(sys)sys...原创 2013-04-16 18:47:59 · 517 阅读 · 0 评论 -
Scrapy 基础(1)
Python开源抓取框架简单介绍,以及安装(ubuntu)常见题目解决发布时间:2012-10-09 发布来源: 这场“血雨腥风”的3SB大战赶紧安适沉着荒僻冷僻下来,还给用户一个稳定均衡的搜刮市场。不过这场战斗总不克不及有始无终吧,小编很是3SB竞技赛能其实为用户带来点儿本质性的益处,那些参战或没参战的搜刮公司多想想怎么进步本身的产品创新力,在顾忌公司受益的同时也多为我们...原创 2013-04-07 18:26:57 · 121 阅读 · 0 评论 -
安装Python-PIP,MySQL-python
sudo yum install MySQL-python sudo yum install mysql-python有时需要: MySQL-shared-compat-5.1.71-1.glibc23.x86_64.rpmyum install mysql-devel 对于 python 通过 2.4 升级到 2.7 以后,将不起作用使用: setuptool...原创 2013-04-07 18:22:01 · 89 阅读 · 0 评论 -
redis-python
#!/usr/bin/env python#coding=utf-8import osimport sysprint 'python redis 'import redisimport redisr = redis.StrictRedis(host='127.0.0.1', port=6379,db = 4)r.set('one', 'hello')pr...原创 2013-04-05 03:04:15 · 87 阅读 · 0 评论 -
python http客户端
'''Created on 2013-3-18@author: lixuan'''# coding=utf-8import urllib2response = urllib2.urlopen('http://python.org/')html = response.read() print htmlreq = urllib2.Request('http:...原创 2013-03-18 16:01:52 · 114 阅读 · 0 评论 -
python crontab 传送文件
10 9,12,18 * * * /usr/local/bin/python /opt/workspace/sohu_mintor/mintor_email/EpaperStarter.py /opt/workspace/sohu_mintor/mintor_email/ >>/opt/workspace/sohu_mintor/mintor_email/log.log 2>&1原创 2013-03-11 17:19:04 · 107 阅读 · 0 评论 -
crontab中运行python程序出错,提示ImportError: No module named解决全过程
原文地址:http://blog.csdn.net/langlang2671/article/details/8259056crontab中运行python程序出错,提示ImportError: No module named解决全过程分类: python linux 2012-12-05 11:10 290人阅读 评论(0) 收藏 举报将一个python脚本放入crontab执行...原创 2013-03-11 16:18:49 · 236 阅读 · 0 评论 -
python 使用本地时区
def getEpubInfo(self): sql = 'select pubid, publish_time,e_type from p_epub_info where is_valid=1' self.cur.execute(sql) datas = self.cur.fetchall(); result=[] ...原创 2013-03-06 18:11:43 · 239 阅读 · 0 评论 -
python修改文件
1 #!/usr/bin/env python 2 #coding=utf-8 3 4 import os 5 import sys 6 7 pubid0=0000000 8 pubid1=1111111 9 path=1111111 10 11 def get_filenames(fdir): 12 13 ret...原创 2013-02-20 14:08:54 · 189 阅读 · 0 评论 -
shutil 复制,移除,数据的model
1 #!/usr/bin/env python 2 import shutil 3 4 shutil.copytree('/home/aircoder/python/api','/home/aircoder/python/bakshutil'); 5原创 2012-12-10 16:40:21 · 112 阅读 · 0 评论 -
简单的文件出来
1 #!/usr/bin/env python 2 #coding=utf-8 3 4 filename = raw_input('Enter file name :'); 5 filen = open(filename) 6 for eachline in filen: 7 try: 8 print eachline.spli...原创 2012-12-05 21:24:12 · 103 阅读 · 0 评论 -
shelve python 的一个简易数据库包和hashlib生产md5加密的包
#!/usr/bin/python#coding=utf-8import hashliba = "a test string"print 'md5:', hashlib.md5(a).hexdigest()#!/usr/bin/env python#coding=utf-8'''shelve python 的一个建议数据库'''import sh...原创 2012-12-05 21:00:17 · 145 阅读 · 0 评论 -
获取文件大小,用户名,平台
#coding=utf-8'''Created on 2012-5-28 @author: air'''import os,sysprint sys.platformimport getpassprint getpass.getuser() # 获取系统的用户名print os.environ['USERNAME']#...原创 2012-11-20 14:10:14 · 106 阅读 · 0 评论