首页 软件开发 代码片段 python ( Page 54 )

python 1073

#Python
一个python的2048简单实现

# -*- coding: utf8 -*- import random data = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0,…

2015-05-13 851

#Python
A*(A星)算法python实现

#!/usr/bin/python # vim:set fileencoding=utf-8 # 在春节放假前两天我偶然看到了A*算法,感觉挺有意思。正好放假前 # 也没有什么事情…

2015-05-13 288

#Python
scrapy在采集网页时使用随机user-agent的方法

默认情况下scrapy采集时只能使用一种user-agent,这样容易被网站屏蔽,下面的代码可以从预先定义的user-agent的列表中随机选择一个来采集不同的页面 在settin…

2015-05-12 751

#Python
使用python3.4解析xml文件(sax、dom、etree)

调用sax模块处理xml文件。 #重载了三个方法 #处理xml,主要就是写自己的事件处理类 from xml.sax import * class DengHandler(Cont…

2015-05-12 420

#Python
python collection模块中几种数据结构(Counter、OrderedDict、namedtup)

collection模块中有几种数据结构我们可能用得到。 Counter是字典的子类,负责计数的一个字典,支持 + 加法 – 减法 & 求公共元素 | 求并集 …

2015-05-12 951

#Python
一列文本转成三列

""" 一列文本进行字符串格式操作转成三列3 依山居 8:18 2015/11/12 题目来源 http://www.bathome.net/thread-38097-1-1.ht…

2015-05-12 746

#Python
mrange 模拟 系统 range

def mrang(start,end=0,step=1): (start,end) = start>end and (end,start) or (start,end) #…

2015-05-12 605

#Python
更加高级的阶乘

f = lambda x: x and x * f(x - 1) or 1 print f(6)

2015-05-12 610

#Python
python实现爬图,不要再爬妹子图了,太没品了

# !/usr/bin python #--*-- coding:utf-8 --*-- ''' 批量下载任意网址上的图片 linux下的路径,有需要的改改路径,很简单,做为学习u…

2015-05-12 342

#Python
统计多台linux主机的CPU内存swap的使用比例

#!/usr/bin/python # -*- coding:utf8 -*- # Email:chenwx716@163.com __author__ = 'chenwx' im…

2015-05-12 559

#Python
word文档批量修改

#!/usr/bin/python """ --------------------------------------------------------------------…

2015-05-11 314

#Python
BeautifulSoup模块的简单使用

可以通过dir(BeautifulSoup.BeautifulSoup)查看其有什么函数,如果想知道某个函数的含义可以使用help(BeautifulSoup.BeautifulS…

2015-05-11 984
1 52 53 54 55 56 90