python
easonworld
这个作者很懒,什么都没留下…
展开
-
Python特殊语法:filter、map、reduce、lambda [转]
Python内置了一些非常有趣但非常有用的函数,充分体现了Python的语言魅力! filter(function, sequence):对sequence中的item依次执行function(item),将执行结果为True的item组成一个List/String/Tuple(取决于sequence的类型)返回: >>> def f(x): return x % 2 != 0 and转载 2012-12-26 18:17:01 · 318 阅读 · 0 评论 -
python处理json
json readed = json.load(open('jsonsource.dat', 'r')) json.dump(readed, open('newjsonfile.dat', 'w'))原创 2014-08-14 18:19:40 · 467 阅读 · 0 评论 -
爬虫:BeautifulSoup
人世间 首页 随想录 技术流 众喧哗 百家言 人世间 海之子 色影心 关于我 Twitter 私信 存档 写成长读人生记生活 当前位置 : 首页 » Python BeautifulSoup 简单笔记 更多3 Python BeautifulSoup 简单笔记 字号:小转载 2014-06-04 16:25:07 · 538 阅读 · 0 评论 -
python连接oracle 以及 ubuntu安装rpm
cx_oracle下载地址: http://sourceforge.net/projects/cx-oracle/files/ oracle instant client下载: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html #!/usr/bin/env python i转载 2013-11-01 14:33:30 · 1062 阅读 · 0 评论 -
cd_old
#!/usr/bin/env python import sys import datetime org_list=[] #存储某个订单在生命周期内所经过的所有站点 dict={} subdict={} subdict1={} subdict2={} subdict3={} org_id='' s_id='' tag='0'原创 2013-11-01 21:50:39 · 573 阅读 · 0 评论 -
py——cd
#!/usr/bin/env python import sys import datetime import cx_Oracle org_type_list=[] org_list=[] dict={} subdict={} subdict1={} subdict2={} subdict3={} org_id='' s_id=''原创 2013-11-01 21:38:09 · 549 阅读 · 0 评论 -
python时间操作
1: 计算时间差 Q:如何方便的计算两个时间的差,如两个时间相差几天,几小时等 A:使用datetime模块可以很方便的解决这个问题,举例如下: import datetime d1 = datetime.datetime(2009, 3, 23) d2 = datetime.datetime(2009, 10, 7) dayCount = (d1 - d2).days p转载 2013-10-31 19:22:21 · 755 阅读 · 0 评论 -
Ubuntu安装eclipse和pydev成功后,新建项目输入项目名的时候出现"Project interpreter not specified"的错误
在Ubuntu安装eclipse和pydev成功后,新建项目输入项目名的时候出现"Project interpreter not specified"的错误,解决方法如下: 1、eclipse下Windows--Preferences,弹出Preferences界面, 2、选择PyDev--Interfreter-Python,弹出Python Interpreters界面, 3、单击new转载 2013-08-22 23:25:28 · 643 阅读 · 0 评论 -
python单元测试
unittest是python单元测试框架,又叫做PyUnit。 之所以称为框架是它代替开发人员完成了一些调用、IO等与单元测试无直接关系的支撑代码,让开发人员可以专注与测试用例的编写,简化单元测试工作。 单元测试是一种基本的,由开发人员(而不是测试人员)完成的测试,保证一个程序基本单元的正确性。“单元”的概念我个人理解就类似电子设备中的元器件,一个个元器件(单元)组成了整个电子设备(程转载 2013-07-18 18:42:16 · 433 阅读 · 0 评论 -
部署python的web项目
Red Hat Linux Enterprise 6 Apache Deploy Guide A simple deploy document which covered apache, django project, wsgi, rhel6. Prerequisites change to root su - install httpd yum install转载 2013-06-28 14:37:31 · 1433 阅读 · 0 评论 -
python 爬虫入门
#!/usr/bin/python # -*- coding:utf-8 -*- from urllib import urlopen from lxml import etree # import lxml.html.soupparser as soupparser orign = "http://www.cedf.org.cn" webpage = u转载 2015-05-11 11:07:29 · 495 阅读 · 0 评论